Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -689,96 +689,11 @@ def update_images():
|
|
689 |
image_3 = generate_image(hardcoded_prompt_3)
|
690 |
return image_1, image_2, image_3
|
691 |
|
692 |
-
# def clear_state_and_textbox():
|
693 |
-
# conversational_memory.clear()
|
694 |
-
# return ""
|
695 |
|
696 |
-
# def transcribe_and_update_textbox(audio, chat_input):
|
697 |
-
# transcribed_text = transcribe(audio)
|
698 |
-
# # return "",transcribed_text
|
699 |
-
# return transcribed_text
|
700 |
-
|
701 |
-
# def transcribe_function_whisper(audio):
|
702 |
-
# sr, y = audio
|
703 |
-
# y = y.astype(np.float32)
|
704 |
-
# y /= np.max(np.abs(y))
|
705 |
-
# result = pipe_asr({"array": y, "sampling_rate": sr}, return_timestamps=False)
|
706 |
-
# full_text = result.get("text", "")
|
707 |
-
# return full_text
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
# def clear_stream_transcription():
|
712 |
-
# return None, ""
|
713 |
|
714 |
def clear_textbox():
|
715 |
return ""
|
716 |
|
717 |
-
# with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
718 |
-
# with gr.Row():
|
719 |
-
# with gr.Column():
|
720 |
-
# state = gr.State()
|
721 |
-
|
722 |
-
# chatbot = gr.Chatbot([], elem_id="RADAR:Channel 94.1", bubble_full_width=False)
|
723 |
-
# choice = gr.Radio(label="Select Style", choices=["Details", "Conversational"], value="Conversational")
|
724 |
-
|
725 |
-
# gr.Markdown("<h1 style='color: red;'>Talk to RADAR</h1>", elem_id="voice-markdown")
|
726 |
-
|
727 |
-
# chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!", placeholder="After Prompt, click Retriever Only")
|
728 |
-
# chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input], api_name="voice_query")
|
729 |
-
# tts_choice = gr.Radio(label="Select TTS System", choices=["Alpha", "Beta", "Gamma"], value="Alpha")
|
730 |
-
# retriever_button = gr.Button("Retriever")
|
731 |
-
|
732 |
-
# gr.Markdown("<h1 style='color: red;'>Radar Map</h1>", elem_id="Map-Radar")
|
733 |
-
# location_output = gr.HTML()
|
734 |
-
# retriever_button.click(fn=add_message, inputs=[chatbot, chat_input], outputs=[chatbot, chat_input]).then(
|
735 |
-
# fn=bot, inputs=[chatbot, choice, tts_choice, state], outputs=[chatbot, gr.Audio(interactive=False, autoplay=True)], api_name="Ask_Retriever").then(
|
736 |
-
# fn=show_map_if_details, inputs=[chatbot, choice], outputs=[location_output, location_output], api_name="map_finder").then(
|
737 |
-
# fn=clear_textbox,inputs=[],outputs=[chat_input]
|
738 |
-
# )
|
739 |
-
# # fn=clear_state_and_textbox, inputs=[], outputs=[chat_input]
|
740 |
-
|
741 |
-
# bot_msg = chat_msg.then(bot, [chatbot, choice, tts_choice], [chatbot], api_name="generate_voice_response")
|
742 |
-
# bot_msg.then(lambda: gr.Textbox(value="", interactive=True, placeholder="Ask Radar!!!...", show_label=False), None, [chat_input])
|
743 |
-
# chatbot.like(print_like_dislike, None, None)
|
744 |
-
# clear_button = gr.Button("Clear")
|
745 |
-
# clear_button.click(fn=clear_textbox, inputs=[], outputs=[chat_input])
|
746 |
-
|
747 |
-
# # New ASR Component with Whisper
|
748 |
-
# gr.Markdown("<h2>Hey Radar</h2>")
|
749 |
-
# audio_input_whisper = gr.Audio(sources=["microphone"], type='numpy')
|
750 |
-
# transcribe_button_whisper = gr.Button("Transcribe")
|
751 |
-
# transcribe_button_whisper.click(fn=transcribe_function_whisper, inputs=[audio_input_whisper], outputs=[chat_input], api_name="whisper_asr")
|
752 |
-
|
753 |
-
|
754 |
-
# # Streaming ASR component
|
755 |
-
# gr.Markdown("<h2>Streaming ASR</h2>")
|
756 |
-
# stream_audio_input = gr.Audio(sources=["microphone"], type='numpy', streaming=True)
|
757 |
-
# stream_transcription = gr.State(None) # Initialize stream state
|
758 |
-
# stream_audio_input.change(transcribe_function, inputs=[stream_transcription, stream_audio_input], outputs=[stream_transcription, chat_input],api_name="text_to_voice")
|
759 |
-
|
760 |
-
# # Add the clear button for ASR history
|
761 |
-
# clear_btn = gr.Button("Clear ASR ")
|
762 |
-
# # clear_btn.click(lambda: [None, ""], outputs=[stream_transcription, chat_input])
|
763 |
-
# clear_button.click(lambda:[None,None] ,outputs=[chat_input, state])
|
764 |
-
|
765 |
-
# # with gr.Column():
|
766 |
-
# # weather_output = gr.HTML(value=fetch_local_weather())
|
767 |
-
# # news_output = gr.HTML(value=fetch_local_news())
|
768 |
-
# # news_output = gr.HTML(value=fetch_local_events())
|
769 |
-
|
770 |
-
# with gr.Column():
|
771 |
-
# image_output_1 = gr.Image(value=generate_image(hardcoded_prompt_1), width=400, height=400)
|
772 |
-
# image_output_2 = gr.Image(value=generate_image(hardcoded_prompt_2), width=400, height=400)
|
773 |
-
# image_output_3 = gr.Image(value=generate_image(hardcoded_prompt_3), width=400, height=400)
|
774 |
-
|
775 |
-
# refresh_button = gr.Button("Refresh Images")
|
776 |
-
# refresh_button.click(fn=update_images, inputs=None, outputs=[image_output_1, image_output_2, image_output_3])
|
777 |
-
# # location_output = gr.HTML()
|
778 |
-
# bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output], api_name="map_finder")
|
779 |
-
|
780 |
-
# demo.queue()
|
781 |
-
# demo.launch(share=True)
|
782 |
|
783 |
with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
784 |
with gr.Row():
|
|
|
689 |
image_3 = generate_image(hardcoded_prompt_3)
|
690 |
return image_1, image_2, image_3
|
691 |
|
|
|
|
|
|
|
692 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
|
694 |
def clear_textbox():
|
695 |
return ""
|
696 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
697 |
|
698 |
with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
699 |
with gr.Row():
|