Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -518,123 +518,60 @@ def generate_image(prompt):
|
|
518 |
return image
|
519 |
|
520 |
# Hardcoded prompt for image generation
|
521 |
-
hardcoded_prompt = "
|
522 |
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
# with gr.Column(scale=5):
|
529 |
-
# gr.Markdown("<h1>Generated Image</h1>", elem_id="image-markdown")
|
530 |
-
# image_output = gr.Image(value=generate_image(hardcoded_prompt))
|
531 |
-
|
532 |
-
# with gr.Column(scale=8):
|
533 |
-
# weather_output = gr.HTML(value=fetch_local_weather())
|
534 |
|
535 |
-
|
536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
|
|
|
|
|
|
|
|
|
|
549 |
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
# chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="Transcription")
|
559 |
-
# chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
560 |
-
# bot_msg = chat_msg.then(bot, [chatbot, choice], chatbot, api_name="bot_response")
|
561 |
-
# bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False), None, [chat_input])
|
562 |
-
# chatbot.like(print_like_dislike, None, None)
|
563 |
-
# clear_button = gr.Button("Clear")
|
564 |
-
# clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
|
565 |
-
|
566 |
-
# with gr.Column(): # Smaller scale for the left column
|
567 |
-
# gr.Markdown("<h1>Stream your Voice</h1>", elem_id="voice-markdown")
|
568 |
-
|
569 |
-
# audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
|
570 |
-
# audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="SAMLOne_real_time")
|
571 |
-
|
572 |
-
# with gr.Row():
|
573 |
-
# with gr.Column():
|
574 |
-
# gr.Markdown("<h1>Locate the Events</h1>", elem_id="location-markdown")
|
575 |
-
|
576 |
-
# location_output = gr.HTML()
|
577 |
-
# bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
|
578 |
-
# with gr.Column():
|
579 |
-
# gr.Markdown("<h1>Listen the audio</h1>", elem_id="audio-markdown")
|
580 |
-
|
581 |
-
# audio_output = gr.Audio()
|
582 |
-
# bot_msg_audio = bot_msg.then(lambda history: generate_audio_elevenlabs(history[-1][1]), chatbot, audio_output)
|
583 |
-
# with gr.Column():
|
584 |
-
# gr.Markdown("<h1>Local Events</h1>", elem_id="events-markdown")
|
585 |
-
|
586 |
-
# news_output = gr.HTML(value=fetch_local_events())
|
587 |
-
|
588 |
-
# with gr.Column():
|
589 |
-
# gr.Markdown("<h1>Generated Image</h1>", elem_id="image-markdown")
|
590 |
-
|
591 |
-
# image_output = gr.Image(value=generate_image(hardcoded_prompt))
|
592 |
-
|
593 |
-
# setup_ui()
|
594 |
-
|
595 |
-
# demo.queue()
|
596 |
-
# demo.launch(share=True)
|
597 |
-
import gradio as gr
|
598 |
-
|
599 |
-
with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
600 |
-
with gr.Row():
|
601 |
-
with gr.Column(scale=2):
|
602 |
-
chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False)
|
603 |
-
gr.Markdown("<h1>Voice Chat</h1>", elem_id="voice-markdown")
|
604 |
-
audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
|
605 |
-
state = gr.State()
|
606 |
-
audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chatbot], api_name="SAMLOne_real_time")
|
607 |
-
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="Transcription")
|
608 |
-
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
609 |
-
bot_msg = chat_msg.then(bot, [chatbot, choice], chatbot, api_name="bot_response")
|
610 |
-
bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False), None, [chat_input])
|
611 |
-
chatbot.like(print_like_dislike, None, None)
|
612 |
-
clear_button = gr.Button("Clear")
|
613 |
-
clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
|
614 |
-
|
615 |
-
with gr.Column(scale=1):
|
616 |
-
gr.Markdown("<h1>Choose the prompt</h1>", elem_id="prompt-markdown")
|
617 |
-
choice = gr.Radio(label="Choose a prompt", choices=["Details", "Conversational"], value="Details")
|
618 |
-
|
619 |
-
with gr.Row():
|
620 |
-
with gr.Column(scale=2):
|
621 |
-
gr.Markdown("<h1>Locate the Events</h1>", elem_id="location-markdown")
|
622 |
-
location_output = gr.HTML()
|
623 |
-
bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
|
624 |
-
|
625 |
-
with gr.Column(scale=1):
|
626 |
-
gr.Markdown("<h1>Generated Audio</h1>", elem_id="audio-markdown")
|
627 |
-
audio_output = gr.Audio()
|
628 |
-
bot_msg_audio = bot_msg.then(lambda history: generate_audio_elevenlabs(history[-1][1]), chatbot, audio_output)
|
629 |
-
|
630 |
-
with gr.Row():
|
631 |
-
with gr.Column(scale=1):
|
632 |
-
gr.Markdown("<h1>Generated Image</h1>", elem_id="image-markdown")
|
633 |
-
image_output = gr.Image(value=generate_image(hardcoded_prompt))
|
634 |
|
635 |
-
|
636 |
-
gr.Markdown("<h1>Local Events</h1>", elem_id="events-markdown")
|
637 |
-
news_output = gr.HTML(value=fetch_local_events())
|
638 |
|
639 |
demo.queue()
|
640 |
-
demo.launch(share=True)
|
|
|
518 |
return image
|
519 |
|
520 |
# Hardcoded prompt for image generation
|
521 |
+
hardcoded_prompt = "Useing The top 10 events and current time - 4:07 PM ,Date - 06/17/2024 ,Weather-Sunny Bright Day.Create Highly Visually Compelling High Resolution and High Quality Photographics Advatizement for 'Toyota'"
|
522 |
|
523 |
+
with gr.Blocks(theme='rawrsor1/Everforest') as demo:
|
524 |
+
with gr.Row():
|
525 |
+
chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False)
|
526 |
+
with gr.Column():
|
527 |
+
weather_output = gr.HTML(value=fetch_local_weather())
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
|
529 |
+
with gr.Column():
|
530 |
+
news_output = gr.HTML(value=fetch_local_news())
|
531 |
+
|
532 |
+
def setup_ui():
|
533 |
+
state = gr.State()
|
534 |
+
with gr.Row():
|
535 |
+
with gr.Column():
|
536 |
+
gr.Markdown("<h1>Choose the prompt</h1>", elem_id="prompt-markdown")
|
537 |
+
choice = gr.Radio(label="Choose a prompt", choices=["Details", "Conversational"], value="Details")
|
538 |
+
with gr.Column(): # Larger scale for the right column
|
539 |
+
gr.Markdown("<h1>Enter the query / Voice Output</h1>", elem_id="query-markdown")
|
540 |
+
|
541 |
+
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="Transcription")
|
542 |
+
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
543 |
+
bot_msg = chat_msg.then(bot, [chatbot, choice], chatbot, api_name="bot_response")
|
544 |
+
bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False), None, [chat_input])
|
545 |
+
chatbot.like(print_like_dislike, None, None)
|
546 |
+
clear_button = gr.Button("Clear")
|
547 |
+
clear_button.click(fn=clear_textbox, inputs=None, outputs=chat_input)
|
548 |
|
549 |
+
with gr.Column(): # Smaller scale for the left column
|
550 |
+
gr.Markdown("<h1>Stream your Voice</h1>", elem_id="voice-markdown")
|
551 |
+
|
552 |
+
audio_input = gr.Audio(sources=["microphone"], streaming=True, type='numpy')
|
553 |
+
audio_input.stream(transcribe_function, inputs=[state, audio_input], outputs=[state, chat_input], api_name="SAMLOne_real_time")
|
554 |
+
|
555 |
+
with gr.Row():
|
556 |
+
with gr.Column():
|
557 |
+
gr.Markdown("<h1>Locate the Events</h1>", elem_id="location-markdown")
|
558 |
+
location_output = gr.HTML()
|
559 |
+
bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output])
|
560 |
+
with gr.Column():
|
561 |
+
gr.Markdown("<h1>Listen the audio</h1>", elem_id="audio-markdown")
|
562 |
+
audio_output = gr.Audio()
|
563 |
+
#bot_msg.then(generate_audio_elevenlabs, chatbot, audio_output)
|
564 |
+
bot_msg_audio = bot_msg.then(lambda history: generate_audio_elevenlabs(history[-1][1]), chatbot, audio_output)
|
565 |
|
566 |
+
with gr.Column():
|
567 |
+
gr.Markdown("<h1>Local Events</h1>", elem_id="events-markdown")
|
568 |
+
news_output = gr.HTML(value=fetch_local_events())
|
569 |
+
|
570 |
+
with gr.Column():
|
571 |
+
gr.Markdown("<h1>Generated Image</h1>", elem_id="image-markdown")
|
572 |
+
image_output = gr.Image(value=generate_image(hardcoded_prompt))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
|
574 |
+
setup_ui()
|
|
|
|
|
575 |
|
576 |
demo.queue()
|
577 |
+
demo.launch(share=True)
|