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