MohammedNasser commited on
Commit
351445c
1 Parent(s): aa70e72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -234,7 +234,7 @@ def chat(user_input):
234
  tts.save(audio_file)
235
 
236
 
237
- return assistant_response, audio_file, gr.update(visible=True)
238
 
239
  with gr.Blocks(css=custom_css) as demo:
240
  pdf_input = gr.File(label="اختر ملف PDF")
@@ -271,7 +271,7 @@ with gr.Blocks(css=custom_css) as demo:
271
  return gr.update(value=value), gr.update(visible=True), gr.update(interactive=False), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
272
 
273
  def clear_chat():
274
- return "", "", gr.update(visible=False) #
275
 
276
  # When the user uploads a file, validate it and then allow PDF upload
277
  pdf_input.change(handle_file_upload, inputs=pdf_input, outputs=[output_label,submit_button_pdf, submit_button_chat, chat_output, chat_input, audio_output, clear_btn])
@@ -280,7 +280,7 @@ with gr.Blocks(css=custom_css) as demo:
280
  submit_button_pdf.click(process_pdf_and_enable_components, inputs=pdf_input, outputs=[output_label, submit_button_chat, submit_button_pdf, chat_output, chat_input, audio_output, clear_btn])
281
  clear_btn.click(clear_chat, outputs=[chat_input, chat_output, audio_output])
282
  # Chat button connection
283
- submit_button_chat.click(chat, inputs=chat_input, outputs=[chat_output, audio_output, audio_output])
284
 
285
 
286
  # Launch the Gradio app
 
234
  tts.save(audio_file)
235
 
236
 
237
+ return assistant_response, audio_file
238
 
239
  with gr.Blocks(css=custom_css) as demo:
240
  pdf_input = gr.File(label="اختر ملف PDF")
 
271
  return gr.update(value=value), gr.update(visible=True), gr.update(interactive=False), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
272
 
273
  def clear_chat():
274
+ return "", "", None
275
 
276
  # When the user uploads a file, validate it and then allow PDF upload
277
  pdf_input.change(handle_file_upload, inputs=pdf_input, outputs=[output_label,submit_button_pdf, submit_button_chat, chat_output, chat_input, audio_output, clear_btn])
 
280
  submit_button_pdf.click(process_pdf_and_enable_components, inputs=pdf_input, outputs=[output_label, submit_button_chat, submit_button_pdf, chat_output, chat_input, audio_output, clear_btn])
281
  clear_btn.click(clear_chat, outputs=[chat_input, chat_output, audio_output])
282
  # Chat button connection
283
+ submit_button_chat.click(chat, inputs=chat_input, outputs=[chat_output, audio_output])
284
 
285
 
286
  # Launch the Gradio app