Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -282,11 +282,11 @@ def bot(history, choice, tts_choice):
|
|
282 |
history[-1][1] = ""
|
283 |
|
284 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
285 |
-
if tts_choice == "
|
286 |
audio_future = executor.submit(generate_audio_elevenlabs, response)
|
287 |
-
elif tts_choice == "
|
288 |
audio_future = executor.submit(generate_audio_parler_tts, response)
|
289 |
-
elif tts_choice == "
|
290 |
audio_future = executor.submit(generate_audio_mars5, response)
|
291 |
|
292 |
|
@@ -307,21 +307,21 @@ def add_message(history, message):
|
|
307 |
history.append((message, None))
|
308 |
return history, gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False)
|
309 |
|
310 |
-
def generate_voice_response(history, tts_choice):
|
311 |
-
|
312 |
-
|
313 |
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
|
323 |
-
|
324 |
-
|
325 |
|
326 |
def print_like_dislike(x: gr.LikeData):
|
327 |
print(x.index, x.value, x.liked)
|
@@ -665,7 +665,7 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
665 |
|
666 |
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!")
|
667 |
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input],api_name="voice_query")
|
668 |
-
tts_choice = gr.Radio(label="Select TTS System", choices=["
|
669 |
retriver_button = gr.Button("Retriver")
|
670 |
retriver_button.click(fn=add_message, inputs=[chatbot, chat_input], outputs=[chatbot, chat_input]).then(
|
671 |
fn=bot, inputs=[chatbot, choice, tts_choice], outputs=[chatbot],api_name="Ask_Retriever")
|
@@ -690,10 +690,10 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
690 |
bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output],api_name="map_finder")
|
691 |
|
692 |
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
|
698 |
with gr.Column():
|
699 |
image_output_1 = gr.Image(value=generate_image(hardcoded_prompt_1), width=400, height=400)
|
|
|
282 |
history[-1][1] = ""
|
283 |
|
284 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
285 |
+
if tts_choice == "Alpha":
|
286 |
audio_future = executor.submit(generate_audio_elevenlabs, response)
|
287 |
+
elif tts_choice == "Beta":
|
288 |
audio_future = executor.submit(generate_audio_parler_tts, response)
|
289 |
+
elif tts_choice == "Gamma":
|
290 |
audio_future = executor.submit(generate_audio_mars5, response)
|
291 |
|
292 |
|
|
|
307 |
history.append((message, None))
|
308 |
return history, gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False)
|
309 |
|
310 |
+
# def generate_voice_response(history, tts_choice):
|
311 |
+
# if not history:
|
312 |
+
# return None
|
313 |
|
314 |
+
# response = history[-1][1]
|
315 |
+
# with concurrent.futures.ThreadPoolExecutor() as executor:
|
316 |
+
# if tts_choice == "Alpha":
|
317 |
+
# audio_future = executor.submit(generate_audio_elevenlabs, response)
|
318 |
+
# elif tts_choice == "Beta":
|
319 |
+
# audio_future = executor.submit(generate_audio_parler_tts, response)
|
320 |
+
# elif tts_choice == "Gamma":
|
321 |
+
# audio_future = executor.submit(generate_audio_mars5, response)
|
322 |
|
323 |
+
# audio_path = audio_future.result()
|
324 |
+
# return audio_path
|
325 |
|
326 |
def print_like_dislike(x: gr.LikeData):
|
327 |
print(x.index, x.value, x.liked)
|
|
|
665 |
|
666 |
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!")
|
667 |
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input],api_name="voice_query")
|
668 |
+
tts_choice = gr.Radio(label="Select TTS System", choices=["Alpha", "Beta", "Gamma"], value="Alpha")
|
669 |
retriver_button = gr.Button("Retriver")
|
670 |
retriver_button.click(fn=add_message, inputs=[chatbot, chat_input], outputs=[chatbot, chat_input]).then(
|
671 |
fn=bot, inputs=[chatbot, choice, tts_choice], outputs=[chatbot],api_name="Ask_Retriever")
|
|
|
690 |
bot_msg.then(show_map_if_details, [chatbot, choice], [location_output, location_output],api_name="map_finder")
|
691 |
|
692 |
|
693 |
+
with gr.Column():
|
694 |
+
weather_output = gr.HTML(value=fetch_local_weather())
|
695 |
+
news_output = gr.HTML(value=fetch_local_news())
|
696 |
+
news_output = gr.HTML(value=fetch_local_events())
|
697 |
|
698 |
with gr.Column():
|
699 |
image_output_1 = gr.Image(value=generate_image(hardcoded_prompt_1), width=400, height=400)
|