Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -577,44 +577,44 @@ with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
|
577 |
image_output_2 = gr.Image(value=generate_image(hardcoded_prompt_2), width=300, height=300)
|
578 |
image_output_3 = gr.Image(value=generate_image(hardcoded_prompt_3), width=300, height=300)
|
579 |
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
|
619 |
demo.queue()
|
620 |
demo.launch(share=True)
|
|
|
577 |
image_output_2 = gr.Image(value=generate_image(hardcoded_prompt_2), width=300, height=300)
|
578 |
image_output_3 = gr.Image(value=generate_image(hardcoded_prompt_3), width=300, height=300)
|
579 |
|
580 |
+
def setup_ui():
|
581 |
+
state = gr.State()
|
582 |
+
with gr.Row():
|
583 |
+
with gr.Column(scale=1):
|
584 |
+
gr.Markdown("<h1>Select Style</h1>", elem_id="prompt-markdown")
|
585 |
+
choice = gr.Radio(label="Select Style", choices=["Details", "Conversational"], value="Conversational")
|
586 |
+
|
587 |
+
with gr.Column(scale=2): # Larger scale for the right column
|
588 |
+
gr.Markdown("<h1>Ask Radar !!!</h1>", elem_id="query-markdown")
|
589 |
+
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!")
|
590 |
+
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
591 |
+
bot_msg = chat_msg.then(bot, [chatbot, choice], [chatbot, gr.Audio(interactive=False, autoplay=True)])
|
592 |
+
bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Ask Radar!!!...", show_label=False), None, [chat_input])
|
593 |
+
chatbot.like(print_like_dislike, None, None)
|
594 |
+
clear_button = gr.Button("Clear")
|
595 |
+
clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
|
596 |
+
|
597 |
+
with gr.Column(scale=1):
|
598 |
+
gr.Markdown("<h1>Talk to RADAR</h1>", elem_id="voice-markdown")
|
599 |
+
audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
|
600 |
+
audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="SAMLOne_real_time")
|
601 |
+
|
602 |
+
with gr.Row():
|
603 |
+
with gr.Column(scale=1):
|
604 |
+
gr.Markdown("<h1>Map</h1>", elem_id="location-markdown")
|
605 |
+
location_output = gr.HTML()
|
606 |
+
bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
|
607 |
+
|
608 |
+
with gr.Row():
|
609 |
+
with gr.Column(scale=1):
|
610 |
+
gr.Markdown("<h1>Suggested Events</h1>", elem_id="events-markdown")
|
611 |
+
events_output = gr.HTML(value=fetch_local_events())
|
612 |
+
|
613 |
+
with gr.Column(scale=1):
|
614 |
+
gr.Markdown("<h1>Omaha Today Headlines</h1>", elem_id="news-markdown")
|
615 |
+
news_output = gr.HTML(value=fetch_local_news())
|
616 |
+
|
617 |
+
setup_ui()
|
618 |
|
619 |
demo.queue()
|
620 |
demo.launch(share=True)
|