Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,9 +14,6 @@ from langchain_together import ChatTogether
|
|
14 |
# تنظیمات کلیدهای API
|
15 |
HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
|
16 |
|
17 |
-
AZURE_SPEECH_API_KEY="e1b8c7909ed5488fad1c92b2bb499fcb"
|
18 |
-
AZURE_SPEECH_REGION="eastus"
|
19 |
-
AZURE_SPEECH_VOICE_NAME="fa-IR-FaridNeural" # مثلاً "fa-IR-FaridNeural"
|
20 |
|
21 |
# اطمینان از تنظیم بودن کلیدهای API
|
22 |
|
@@ -359,7 +356,7 @@ with gr.Blocks() as demo:
|
|
359 |
|
360 |
# تبدیل پاسخ به صوت
|
361 |
audio_data = synthesize_speech(bot_response)
|
362 |
-
return chat_history, ""
|
363 |
|
364 |
def response_voice(audio, chat_history):
|
365 |
if not audio:
|
@@ -392,11 +389,11 @@ with gr.Blocks() as demo:
|
|
392 |
fixed_bot_response = fix_bidi_text(bot_response)
|
393 |
chat_history.append(("صدا ارسال شد", fixed_bot_response))
|
394 |
return chat_history, ""
|
395 |
-
submit_btn.click(respond, [msg, chatbot], [chatbot, msg
|
396 |
voice_btn.click(response_voice, [audio_input, chatbot], [chatbot, msg, audio_output])
|
397 |
voice_btn1.click(response_voice1, [inputs, chatbot], [chatbot, msg])
|
398 |
|
399 |
-
msg.submit(respond, [msg, chatbot], [chatbot, msg
|
400 |
clear_btn.click(clear_memory, inputs=None, outputs=[chatbot, msg, audio_output,audio_input])
|
401 |
|
402 |
# اجرای Gradio
|
|
|
14 |
# تنظیمات کلیدهای API
|
15 |
HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
|
16 |
|
|
|
|
|
|
|
17 |
|
18 |
# اطمینان از تنظیم بودن کلیدهای API
|
19 |
|
|
|
356 |
|
357 |
# تبدیل پاسخ به صوت
|
358 |
audio_data = synthesize_speech(bot_response)
|
359 |
+
return chat_history, "" # افزودن audio_data به خروجی
|
360 |
|
361 |
def response_voice(audio, chat_history):
|
362 |
if not audio:
|
|
|
389 |
fixed_bot_response = fix_bidi_text(bot_response)
|
390 |
chat_history.append(("صدا ارسال شد", fixed_bot_response))
|
391 |
return chat_history, ""
|
392 |
+
submit_btn.click(respond, [msg, chatbot], [chatbot, msg])
|
393 |
voice_btn.click(response_voice, [audio_input, chatbot], [chatbot, msg, audio_output])
|
394 |
voice_btn1.click(response_voice1, [inputs, chatbot], [chatbot, msg])
|
395 |
|
396 |
+
msg.submit(respond, [msg, chatbot], [chatbot, msg])
|
397 |
clear_btn.click(clear_memory, inputs=None, outputs=[chatbot, msg, audio_output,audio_input])
|
398 |
|
399 |
# اجرای Gradio
|