eswardivi commited on
Commit
476a003
Β·
verified Β·
1 Parent(s): 18abbdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
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
- money_btn.click(fn=fetch_audio, inputs="Money", outputs=money_audio)
 
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
- geo_btn.click(fn=fetch_audio, inputs="Geopolitical", outputs=geo_audio)
 
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
- world_btn.click(fn=fetch_audio, inputs="World", outputs=world_audio)
 
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
- ent_btn.click(fn=fetch_audio, inputs="Entertainment", outputs=ent_audio)
 
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
- health_btn.click(fn=fetch_audio, inputs="Health", outputs=health_audio)
 
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
- sports_btn.click(fn=fetch_audio, inputs="Sports", outputs=sports_audio)
 
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