import gradio as gr # Audio URLs AUDIO_URLS = { "Money": "https://pub-6dc43089a07d4218adb4b0579b3be0b9.r2.dev/News/News_Money.wav", "Geopolitical": "https://pub-6dc43089a07d4218adb4b0579b3be0b9.r2.dev/News/News_Geopolitical.wav", "World": "https://pub-6dc43089a07d4218adb4b0579b3be0b9.r2.dev/News/News_World.wav", "Entertainment": "https://pub-6dc43089a07d4218adb4b0579b3be0b9.r2.dev/News/News_Entertainment.wav", "Health": "https://pub-6dc43089a07d4218adb4b0579b3be0b9.r2.dev/News/News_Health.wav", "Sports": "https://pub-6dc43089a07d4218adb4b0579b3be0b9.r2.dev/News/News_Sports.wav" } def fetch_audio(category): return AUDIO_URLS[category] def create_news_dashboard(): with gr.Blocks(theme=gr.themes.Soft()) as demo: gr.Markdown("# 📻 Radio News Dashboard") with gr.Row(): with gr.Column(scale=1): gr.Markdown("### 💰 Money News") money_audio = gr.Audio(interactive=False) money_btn = gr.Button("Play Money News") money_btn.click(fn=fetch_audio, inputs=gr.State("Money"), outputs=money_audio) with gr.Column(scale=1): gr.Markdown("### 🌍 Geopolitical News") geo_audio = gr.Audio(interactive=False) geo_btn = gr.Button("Play Geopolitical News") geo_btn.click(fn=fetch_audio, inputs=gr.State("Geopolitical"), outputs=geo_audio) with gr.Column(scale=1): gr.Markdown("### 🌐 World News") world_audio = gr.Audio(interactive=False) world_btn = gr.Button("Play World News") world_btn.click(fn=fetch_audio, inputs=gr.State("World"), outputs=world_audio) with gr.Row(): with gr.Column(scale=1): gr.Markdown("### 🎭 Entertainment") ent_audio = gr.Audio(interactive=False) ent_btn = gr.Button("Play Entertainment News") ent_btn.click(fn=fetch_audio, inputs=gr.State("Entertainment"), outputs=ent_audio) with gr.Column(scale=1): gr.Markdown("### 🏥 Health News") health_audio = gr.Audio(interactive=False) health_btn = gr.Button("Play Health News") health_btn.click(fn=fetch_audio, inputs=gr.State("Health"), outputs=health_audio) with gr.Column(scale=1): gr.Markdown("### 🏆 Sports News") sports_audio = gr.Audio(interactive=False) sports_btn = gr.Button("Play Sports News") sports_btn.click(fn=fetch_audio, inputs=gr.State("Sports"), outputs=sports_audio) return demo if __name__ == "__main__": demo = create_news_dashboard() demo.launch()