MohammedNasser commited on
Commit
d54a402
·
verified ·
1 Parent(s): a0b5949

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -254,14 +254,18 @@ with gr.Blocks(css=custom_css) as demo:
254
  if is_valid:
255
  # Enable the upload button if the file is valid
256
  output_label.value=''
 
257
  else:
258
  output_label.value=f'<span style="color:{color}">{message}</span>'
 
259
 
260
  def process_pdf_and_enable_components(pdf):
261
  # Process PDF and activate the other components
262
  output_label.value='<span style="color:blue">جاري معالجة الملف...</span>'
263
  message, is_valid = upload_pdf(pdf)
264
  output_label.value=f'<span style="color:green">{message}</span>'
 
 
265
 
266
  # When the user uploads a file, validate it and then allow PDF upload
267
  pdf_input.change(handle_file_upload, inputs=pdf_input, outputs=[output_label,submit_button_pdf])
 
254
  if is_valid:
255
  # Enable the upload button if the file is valid
256
  output_label.value=''
257
+ return output_label, gr.update(interactive=True)
258
  else:
259
  output_label.value=f'<span style="color:{color}">{message}</span>'
260
+ return output_label, gr.update(interactive=False)
261
 
262
  def process_pdf_and_enable_components(pdf):
263
  # Process PDF and activate the other components
264
  output_label.value='<span style="color:blue">جاري معالجة الملف...</span>'
265
  message, is_valid = upload_pdf(pdf)
266
  output_label.value=f'<span style="color:green">{message}</span>'
267
+ return output_label, gr.update(interactive=True)
268
+
269
 
270
  # When the user uploads a file, validate it and then allow PDF upload
271
  pdf_input.change(handle_file_upload, inputs=pdf_input, outputs=[output_label,submit_button_pdf])