Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,38 +34,44 @@ def create_news_dashboard():
|
|
34 |
gr.Markdown("### π° Money News")
|
35 |
money_audio = gr.Audio(interactive=False, type="filepath")
|
36 |
money_btn = gr.Button("Play Money News")
|
37 |
-
|
|
|
38 |
|
39 |
with gr.Column(scale=1):
|
40 |
gr.Markdown("### π Geopolitical News")
|
41 |
geo_audio = gr.Audio(interactive=False, type="filepath")
|
42 |
geo_btn = gr.Button("Play Geopolitical News")
|
43 |
-
|
|
|
44 |
|
45 |
with gr.Column(scale=1):
|
46 |
gr.Markdown("### π World News")
|
47 |
world_audio = gr.Audio(interactive=False, type="filepath")
|
48 |
world_btn = gr.Button("Play World News")
|
49 |
-
|
|
|
50 |
|
51 |
with gr.Row():
|
52 |
with gr.Column(scale=1):
|
53 |
gr.Markdown("### π Entertainment")
|
54 |
ent_audio = gr.Audio(interactive=False, type="filepath")
|
55 |
ent_btn = gr.Button("Play Entertainment News")
|
56 |
-
|
|
|
57 |
|
58 |
with gr.Column(scale=1):
|
59 |
gr.Markdown("### π₯ Health News")
|
60 |
health_audio = gr.Audio(interactive=False, type="filepath")
|
61 |
health_btn = gr.Button("Play Health News")
|
62 |
-
|
|
|
63 |
|
64 |
with gr.Column(scale=1):
|
65 |
gr.Markdown("### π Sports News")
|
66 |
sports_audio = gr.Audio(interactive=False, type="filepath")
|
67 |
sports_btn = gr.Button("Play Sports News")
|
68 |
-
|
|
|
69 |
|
70 |
return demo
|
71 |
|
|
|
34 |
gr.Markdown("### π° Money News")
|
35 |
money_audio = gr.Audio(interactive=False, type="filepath")
|
36 |
money_btn = gr.Button("Play Money News")
|
37 |
+
money_state = gr.State("Money") # Use gr.State for category
|
38 |
+
money_btn.click(fn=fetch_audio, inputs=money_state, outputs=money_audio)
|
39 |
|
40 |
with gr.Column(scale=1):
|
41 |
gr.Markdown("### π Geopolitical News")
|
42 |
geo_audio = gr.Audio(interactive=False, type="filepath")
|
43 |
geo_btn = gr.Button("Play Geopolitical News")
|
44 |
+
geo_state = gr.State("Geopolitical") # Use gr.State for category
|
45 |
+
geo_btn.click(fn=fetch_audio, inputs=geo_state, outputs=geo_audio)
|
46 |
|
47 |
with gr.Column(scale=1):
|
48 |
gr.Markdown("### π World News")
|
49 |
world_audio = gr.Audio(interactive=False, type="filepath")
|
50 |
world_btn = gr.Button("Play World News")
|
51 |
+
world_state = gr.State("World") # Use gr.State for category
|
52 |
+
world_btn.click(fn=fetch_audio, inputs=world_state, outputs=world_audio)
|
53 |
|
54 |
with gr.Row():
|
55 |
with gr.Column(scale=1):
|
56 |
gr.Markdown("### π Entertainment")
|
57 |
ent_audio = gr.Audio(interactive=False, type="filepath")
|
58 |
ent_btn = gr.Button("Play Entertainment News")
|
59 |
+
ent_state = gr.State("Entertainment") # Use gr.State for category
|
60 |
+
ent_btn.click(fn=fetch_audio, inputs=ent_state, outputs=ent_audio)
|
61 |
|
62 |
with gr.Column(scale=1):
|
63 |
gr.Markdown("### π₯ Health News")
|
64 |
health_audio = gr.Audio(interactive=False, type="filepath")
|
65 |
health_btn = gr.Button("Play Health News")
|
66 |
+
health_state = gr.State("Health") # Use gr.State for category
|
67 |
+
health_btn.click(fn=fetch_audio, inputs=health_state, outputs=health_audio)
|
68 |
|
69 |
with gr.Column(scale=1):
|
70 |
gr.Markdown("### π Sports News")
|
71 |
sports_audio = gr.Audio(interactive=False, type="filepath")
|
72 |
sports_btn = gr.Button("Play Sports News")
|
73 |
+
sports_state = gr.State("Sports") # Use gr.State for category
|
74 |
+
sports_btn.click(fn=fetch_audio, inputs=sports_state, outputs=sports_audio)
|
75 |
|
76 |
return demo
|
77 |
|