MohammedNasser commited on
Commit
85be37d
1 Parent(s): aeb7a6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -242,7 +242,7 @@ with gr.Blocks(css=custom_css) as demo:
242
  submit_button_pdf = gr.Button("ارفع الملف", interactive=False)
243
 
244
  chat_input = gr.Textbox(label="أدخل سؤالك هنا 💬", rtl=True, visible=False)
245
- chat_output = gr.Textbox(label="الردالآلي 🤖", rtl=True, visible=False)
246
  audio_output = gr.Audio(label="🔊", visible=False)
247
  with gr.Group():
248
  submit_button_chat = gr.Button("إرسال", interactive=True, visible=False)
@@ -271,14 +271,14 @@ 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 "", "" #
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])
278
 
279
  # When the user presses the upload button, process the PDF and enable other components
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])
282
  # Chat button connection
283
  submit_button_chat.click(chat, inputs=chat_input, outputs=[chat_output, audio_output])
284
 
 
242
  submit_button_pdf = gr.Button("ارفع الملف", interactive=False)
243
 
244
  chat_input = gr.Textbox(label="أدخل سؤالك هنا 💬", rtl=True, visible=False)
245
+ chat_output = gr.Textbox(label="الرد الآلي 🤖", rtl=True, visible=False)
246
  audio_output = gr.Audio(label="🔊", visible=False)
247
  with gr.Group():
248
  submit_button_chat = gr.Button("إرسال", interactive=True, visible=False)
 
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 "", "","" #
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])
278
 
279
  # When the user presses the upload button, process the PDF and enable other components
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