MohammedNasser commited on
Commit
fd09410
1 Parent(s): 93eb31f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -238,7 +238,7 @@ def chat(user_input):
238
  with gr.Blocks(css=custom_css) as demo:
239
 
240
  pdf_input = gr.File(label="اختر ملف PDF")
241
- output_label = gr.HTML("") # Replaced Textbox with HTML for label
242
  submit_button_pdf = gr.Button("ارفع الملف", interactive=False)
243
  chat_input = gr.Textbox(label="أدخل سؤالك هنا", interactive=False)
244
  chat_output = gr.Textbox(label="الرد الآلي", interactive=False)
@@ -246,7 +246,7 @@ with gr.Blocks(css=custom_css) as demo:
246
  submit_button_chat = gr.Button("إرسال", interactive=False)
247
 
248
  def handle_file_upload(pdf):
249
- output_label.update('')
250
  message, is_valid = validate_pdf(pdf)
251
  color = "red" if not is_valid else "green"
252
  # Update HTML label instead of Textbox
@@ -254,15 +254,15 @@ with gr.Blocks(css=custom_css) as demo:
254
  if is_valid:
255
  # Enable the upload button if the file is valid
256
  submit_button_pdf.update(interactive=True)
257
- output_label.update('')
258
  else:
259
- output_label.update(f'<span style="color:{color}">{message}</span>')
260
 
261
  def process_pdf_and_enable_components(pdf):
262
  # Process PDF and activate the other components
263
- output_label.update('<span style="color:green">جاري معالجة الملف...</span>')
264
  message, is_valid = upload_pdf(pdf)
265
- output_label.update(f'<span style="color:green">{message}</span>')
266
  if is_valid:
267
  chat_input.update(interactive=True)
268
  chat_output.update(interactive=True)
 
238
  with gr.Blocks(css=custom_css) as demo:
239
 
240
  pdf_input = gr.File(label="اختر ملف PDF")
241
+ output_label = gr.HTML(value='') # Replaced Textbox with HTML for label
242
  submit_button_pdf = gr.Button("ارفع الملف", interactive=False)
243
  chat_input = gr.Textbox(label="أدخل سؤالك هنا", interactive=False)
244
  chat_output = gr.Textbox(label="الرد الآلي", interactive=False)
 
246
  submit_button_chat = gr.Button("إرسال", interactive=False)
247
 
248
  def handle_file_upload(pdf):
249
+ output_label.value('')
250
  message, is_valid = validate_pdf(pdf)
251
  color = "red" if not is_valid else "green"
252
  # Update HTML label instead of Textbox
 
254
  if is_valid:
255
  # Enable the upload button if the file is valid
256
  submit_button_pdf.update(interactive=True)
257
+ output_label.value('')
258
  else:
259
+ output_label.value(f'<span style="color:{color}">{message}</span>')
260
 
261
  def process_pdf_and_enable_components(pdf):
262
  # Process PDF and activate the other components
263
+ output_label.value('<span style="color:green">جاري معالجة الملف...</span>')
264
  message, is_valid = upload_pdf(pdf)
265
+ output_label.value(f'<span style="color:green">{message}</span>')
266
  if is_valid:
267
  chat_input.update(interactive=True)
268
  chat_output.update(interactive=True)