ASG Models commited on
Commit
d2e875d
·
verified ·
1 Parent(s): 102ba33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -183,7 +183,7 @@ def chatbot_fn(input_text, input_audio):
183
  # response_text = model.generate_response(input_text, chat_history)
184
  # response_audio = convert_text_to_speech(response_text)
185
 
186
- chat_history.append((None, response_audio)) # إضافة رد البوت
187
 
188
  return chat_history
189
  with gr.Blocks() as demo: # Use gr.Blocks to wrap the entire interface
@@ -193,8 +193,10 @@ with gr.Blocks() as demo: # Use gr.Blocks to wrap the entire interface
193
  with gr.Row():
194
  txt = gr.Textbox(label="أدخل رسالتك")
195
  audio = gr.Audio(sources="microphone", type="filepath")
196
- txt.change(chatbot_fn, [txt, audio], chatbot)
197
- audio.change(chatbot_fn, [txt, audio], chatbot)
 
 
198
 
199
  with gr.Tab("Chat AI "):
200
  gr.Markdown("## AI: محادثة صوتية بالذكاء الاصطناعي باللهجة السعودية")
 
183
  # response_text = model.generate_response(input_text, chat_history)
184
  # response_audio = convert_text_to_speech(response_text)
185
 
186
+ chat_history.append((response_text, response_audio)) # إضافة رد البوت
187
 
188
  return chat_history
189
  with gr.Blocks() as demo: # Use gr.Blocks to wrap the entire interface
 
193
  with gr.Row():
194
  txt = gr.Textbox(label="أدخل رسالتك")
195
  audio = gr.Audio(sources="microphone", type="filepath")
196
+ btn_ai_submit = gr.Button("submit")
197
+
198
+ btn_ai_submit.click(chatbot_fn, [txt, audio], chatbot)
199
+ # audio.change(chatbot_fn, [txt, audio], chatbot)
200
 
201
  with gr.Tab("Chat AI "):
202
  gr.Markdown("## AI: محادثة صوتية بالذكاء الاصطناعي باللهجة السعودية")