Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -563,30 +563,90 @@ hardcoded_prompt_3 = "Create a high-energy scene of a DJ performing on a large s
|
|
563 |
|
564 |
|
565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
567 |
with gr.Row():
|
568 |
-
|
569 |
-
|
570 |
-
weather_output = gr.HTML(value=fetch_local_weather())
|
571 |
|
572 |
-
with gr.Column():
|
573 |
-
gr.Markdown("<h1>Sponsored</h1>", elem_id="
|
|
|
|
|
574 |
image_output_1 = gr.Image(value=generate_image(hardcoded_prompt_1), width=300, height=300)
|
575 |
image_output_2 = gr.Image(value=generate_image(hardcoded_prompt_2), width=300, height=300)
|
576 |
image_output_3 = gr.Image(value=generate_image(hardcoded_prompt_3), width=300, height=300)
|
577 |
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
def setup_ui():
|
582 |
state = gr.State()
|
583 |
with gr.Row():
|
584 |
-
with gr.Column():
|
585 |
gr.Markdown("<h1>Select Style</h1>", elem_id="prompt-markdown")
|
586 |
choice = gr.Radio(label="Select Style", choices=["Details", "Conversational"], value="Conversational")
|
587 |
-
with gr.Column(): # Larger scale for the right column
|
588 |
-
gr.Markdown("<h1>Ask Radar !!!</h1>", elem_id="query-markdown")
|
589 |
|
|
|
|
|
590 |
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!")
|
591 |
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
592 |
bot_msg = chat_msg.then(bot, [chatbot, choice], [chatbot, gr.Audio(interactive=False, autoplay=True)])
|
@@ -594,92 +654,32 @@ with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
|
594 |
chatbot.like(print_like_dislike, None, None)
|
595 |
clear_button = gr.Button("Clear")
|
596 |
clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
|
597 |
-
|
598 |
-
with gr.Column(): # Smaller scale for the left column
|
599 |
-
gr.Markdown("<h1>Talk to RADAR</h1>", elem_id="voice-markdown")
|
600 |
|
|
|
|
|
601 |
audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
|
602 |
audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="SAMLOne_real_time")
|
603 |
|
604 |
with gr.Row():
|
605 |
-
with gr.Column():
|
606 |
gr.Markdown("<h1>Map</h1>", elem_id="location-markdown")
|
607 |
location_output = gr.HTML()
|
608 |
bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
# gr.Markdown("<h1>Listen to the audio</h1>", elem_id="audio-markdown")
|
613 |
-
# audio_output = gr.Audio()
|
614 |
-
# bot_msg_audio = bot_msg.then(lambda history: generate_audio_elevenlabs(history[-1][1]), chatbot, audio_output)
|
615 |
-
with gr.Row():
|
616 |
-
|
617 |
-
with gr.Column():
|
618 |
gr.Markdown("<h1>Suggested Events</h1>", elem_id="events-markdown")
|
619 |
-
|
620 |
-
|
621 |
-
with gr.Column():
|
|
|
622 |
news_output = gr.HTML(value=fetch_local_news())
|
623 |
-
|
|
|
624 |
|
625 |
demo.queue()
|
626 |
demo.launch(share=True)
|
627 |
|
628 |
-
# with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
629 |
-
# with gr.Row().style(equal_height=True):
|
630 |
-
# with gr.Column(scale=2):
|
631 |
-
# chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False)
|
632 |
-
|
633 |
-
# with gr.Column(scale=1):
|
634 |
-
# gr.Markdown("<h1>Weather & Sponsored</h1>", elem_id="weather-sponsored-section")
|
635 |
-
# weather_output = gr.HTML(value=fetch_local_weather())
|
636 |
-
# gr.Markdown("<h2>Sponsored</h2>", elem_id="image-markdown")
|
637 |
-
# image_output_1 = gr.Image(value=generate_image(hardcoded_prompt_1), width=300, height=300)
|
638 |
-
# image_output_2 = gr.Image(value=generate_image(hardcoded_prompt_2), width=300, height=300)
|
639 |
-
# image_output_3 = gr.Image(value=generate_image(hardcoded_prompt_3), width=300, height=300)
|
640 |
-
|
641 |
-
# def setup_ui():
|
642 |
-
# state = gr.State()
|
643 |
-
# with gr.Row().style(equal_height=True):
|
644 |
-
# with gr.Column(scale=1):
|
645 |
-
# gr.Markdown("<h1>Select Style</h1>", elem_id="prompt-markdown")
|
646 |
-
# choice = gr.Radio(label="Select Style", choices=["Details", "Conversational"], value="Conversational")
|
647 |
-
|
648 |
-
# with gr.Column(scale=2): # Larger scale for the right column
|
649 |
-
# gr.Markdown("<h1>Ask Radar !!!</h1>", elem_id="query-markdown")
|
650 |
-
# chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!")
|
651 |
-
# chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
652 |
-
# bot_msg = chat_msg.then(bot, [chatbot, choice], [chatbot, gr.Audio(interactive=False, autoplay=True)])
|
653 |
-
# bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Ask Radar!!!...", show_label=False), None, [chat_input])
|
654 |
-
# chatbot.like(print_like_dislike, None, None)
|
655 |
-
# clear_button = gr.Button("Clear")
|
656 |
-
# clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
|
657 |
-
|
658 |
-
# with gr.Column(scale=1):
|
659 |
-
# gr.Markdown("<h1>Talk to RADAR</h1>", elem_id="voice-markdown")
|
660 |
-
# audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
|
661 |
-
# audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="SAMLOne_real_time")
|
662 |
-
|
663 |
-
# with gr.Row().style(equal_height=True):
|
664 |
-
# with gr.Column(scale=1):
|
665 |
-
# gr.Markdown("<h1>Map</h1>", elem_id="location-markdown")
|
666 |
-
# location_output = gr.HTML()
|
667 |
-
# bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
|
668 |
-
|
669 |
-
# with gr.Row().style(equal_height=True):
|
670 |
-
# with gr.Column(scale=1):
|
671 |
-
# gr.Markdown("<h1>Suggested Events</h1>", elem_id="events-markdown")
|
672 |
-
# events_output = gr.HTML(value=fetch_local_events())
|
673 |
-
|
674 |
-
# with gr.Column(scale=1):
|
675 |
-
# gr.Markdown("<h1>Omaha Today Headlines</h1>", elem_id="news-markdown")
|
676 |
-
# news_output = gr.HTML(value=fetch_local_news())
|
677 |
-
|
678 |
-
# setup_ui()
|
679 |
-
|
680 |
-
# demo.queue()
|
681 |
-
# demo.launch(share=True)
|
682 |
-
|
683 |
|
684 |
|
685 |
|
|
|
563 |
|
564 |
|
565 |
|
566 |
+
# with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
567 |
+
# with gr.Row():
|
568 |
+
# chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False)
|
569 |
+
# with gr.Column():
|
570 |
+
# weather_output = gr.HTML(value=fetch_local_weather())
|
571 |
+
|
572 |
+
# with gr.Column():
|
573 |
+
# gr.Markdown("<h1>Sponsored</h1>", elem_id="image-markdown")
|
574 |
+
# image_output_1 = gr.Image(value=generate_image(hardcoded_prompt_1), width=300, height=300)
|
575 |
+
# image_output_2 = gr.Image(value=generate_image(hardcoded_prompt_2), width=300, height=300)
|
576 |
+
# image_output_3 = gr.Image(value=generate_image(hardcoded_prompt_3), width=300, height=300)
|
577 |
+
|
578 |
+
|
579 |
+
|
580 |
+
|
581 |
+
# def setup_ui():
|
582 |
+
# state = gr.State()
|
583 |
+
# with gr.Row():
|
584 |
+
# with gr.Column():
|
585 |
+
# gr.Markdown("<h1>Select Style</h1>", elem_id="prompt-markdown")
|
586 |
+
# choice = gr.Radio(label="Select Style", choices=["Details", "Conversational"], value="Conversational")
|
587 |
+
# with gr.Column(): # Larger scale for the right column
|
588 |
+
# gr.Markdown("<h1>Ask Radar !!!</h1>", elem_id="query-markdown")
|
589 |
+
|
590 |
+
# chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!")
|
591 |
+
# chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
592 |
+
# bot_msg = chat_msg.then(bot, [chatbot, choice], [chatbot, gr.Audio(interactive=False, autoplay=True)])
|
593 |
+
# bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Ask Radar!!!...", show_label=False), None, [chat_input])
|
594 |
+
# chatbot.like(print_like_dislike, None, None)
|
595 |
+
# clear_button = gr.Button("Clear")
|
596 |
+
# clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
|
597 |
+
|
598 |
+
# with gr.Column(): # Smaller scale for the left column
|
599 |
+
# gr.Markdown("<h1>Talk to RADAR</h1>", elem_id="voice-markdown")
|
600 |
+
|
601 |
+
# audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
|
602 |
+
# audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="SAMLOne_real_time")
|
603 |
+
|
604 |
+
# with gr.Row():
|
605 |
+
# with gr.Column():
|
606 |
+
# gr.Markdown("<h1>Map</h1>", elem_id="location-markdown")
|
607 |
+
# location_output = gr.HTML()
|
608 |
+
# bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
|
609 |
+
|
610 |
+
|
611 |
+
# # with gr.Column():
|
612 |
+
# # gr.Markdown("<h1>Listen to the audio</h1>", elem_id="audio-markdown")
|
613 |
+
# # audio_output = gr.Audio()
|
614 |
+
# # bot_msg_audio = bot_msg.then(lambda history: generate_audio_elevenlabs(history[-1][1]), chatbot, audio_output)
|
615 |
+
# with gr.Row():
|
616 |
+
|
617 |
+
# with gr.Column():
|
618 |
+
# gr.Markdown("<h1>Suggested Events</h1>", elem_id="events-markdown")
|
619 |
+
# news_output = gr.HTML(value=fetch_local_events())
|
620 |
+
|
621 |
+
# with gr.Column():
|
622 |
+
# news_output = gr.HTML(value=fetch_local_news())
|
623 |
+
# setup_ui()
|
624 |
+
|
625 |
+
# demo.queue()
|
626 |
+
# demo.launch(share=True)
|
627 |
+
|
628 |
with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
629 |
with gr.Row():
|
630 |
+
with gr.Column(scale=2):
|
631 |
+
chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False)
|
|
|
632 |
|
633 |
+
with gr.Column(scale=1):
|
634 |
+
gr.Markdown("<h1>Weather & Sponsored</h1>", elem_id="weather-sponsored-section")
|
635 |
+
weather_output = gr.HTML(value=fetch_local_weather())
|
636 |
+
gr.Markdown("<h2>Sponsored</h2>", elem_id="image-markdown")
|
637 |
image_output_1 = gr.Image(value=generate_image(hardcoded_prompt_1), width=300, height=300)
|
638 |
image_output_2 = gr.Image(value=generate_image(hardcoded_prompt_2), width=300, height=300)
|
639 |
image_output_3 = gr.Image(value=generate_image(hardcoded_prompt_3), width=300, height=300)
|
640 |
|
|
|
|
|
|
|
641 |
def setup_ui():
|
642 |
state = gr.State()
|
643 |
with gr.Row():
|
644 |
+
with gr.Column(scale=1):
|
645 |
gr.Markdown("<h1>Select Style</h1>", elem_id="prompt-markdown")
|
646 |
choice = gr.Radio(label="Select Style", choices=["Details", "Conversational"], value="Conversational")
|
|
|
|
|
647 |
|
648 |
+
with gr.Column(scale=2): # Larger scale for the right column
|
649 |
+
gr.Markdown("<h1>Ask Radar !!!</h1>", elem_id="query-markdown")
|
650 |
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!")
|
651 |
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
652 |
bot_msg = chat_msg.then(bot, [chatbot, choice], [chatbot, gr.Audio(interactive=False, autoplay=True)])
|
|
|
654 |
chatbot.like(print_like_dislike, None, None)
|
655 |
clear_button = gr.Button("Clear")
|
656 |
clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
|
|
|
|
|
|
|
657 |
|
658 |
+
with gr.Column(scale=1):
|
659 |
+
gr.Markdown("<h1>Talk to RADAR</h1>", elem_id="voice-markdown")
|
660 |
audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
|
661 |
audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="SAMLOne_real_time")
|
662 |
|
663 |
with gr.Row():
|
664 |
+
with gr.Column(scale=1):
|
665 |
gr.Markdown("<h1>Map</h1>", elem_id="location-markdown")
|
666 |
location_output = gr.HTML()
|
667 |
bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
|
668 |
+
|
669 |
+
with gr.Row():
|
670 |
+
with gr.Column(scale=1):
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
gr.Markdown("<h1>Suggested Events</h1>", elem_id="events-markdown")
|
672 |
+
events_output = gr.HTML(value=fetch_local_events())
|
673 |
+
|
674 |
+
with gr.Column(scale=1):
|
675 |
+
gr.Markdown("<h1>Omaha Today Headlines</h1>", elem_id="news-markdown")
|
676 |
news_output = gr.HTML(value=fetch_local_news())
|
677 |
+
|
678 |
+
setup_ui()
|
679 |
|
680 |
demo.queue()
|
681 |
demo.launch(share=True)
|
682 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
|
684 |
|
685 |
|