Workpam commited on
Commit
76cde08
Β·
verified Β·
1 Parent(s): e459c07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -38
app.py CHANGED
@@ -557,25 +557,10 @@ with gr.Blocks(css=css) as demo:
557
  with gr.Row():
558
  with gr.Column(scale=3, min_width=500):
559
  with gr.Group(elem_classes="panel"):
560
- mode_toggle = gr.Radio(
561
- ["πŸ“„ Upload Workbook", "πŸ“€ Upload Images"],
562
- value="πŸ“„ Upload Workbook",
563
- label="Select Input Method"
564
- )
565
- workbook_upload = gr.File(
566
- label="πŸ“‚ Upload .xlsx/.xlsm Workbook",
567
- file_types=['.xlsx', '.xlsm'],
568
- visible=True
569
- )
570
- upload_box = gr.File(
571
- label="πŸ“ Upload Images",
572
- file_count="multiple",
573
- visible=False
574
- )
575
- image_url_input = gr.Textbox(
576
- label="🌐 Paste Image URL",
577
- visible=False
578
- )
579
 
580
  def toggle_inputs(choice):
581
  is_wb = choice.startswith("πŸ“„")
@@ -585,25 +570,9 @@ with gr.Blocks(css=css) as demo:
585
  gr.update(visible=not is_wb)
586
  )
587
 
588
- mode_toggle.change(
589
- fn=toggle_inputs,
590
- inputs=[mode_toggle],
591
- outputs=[workbook_upload, upload_box, image_url_input]
592
- )
593
-
594
- # now we can safely reference `status` here
595
- workbook_upload.change(
596
- fn=read_uploaded_workbook,
597
- inputs=[workbook_upload],
598
- outputs=[image_data_state, status]
599
- )
600
- upload_box.change(
601
- lambda files: f"{len(files)} files ready." if files else "No files selected",
602
- inputs=[upload_box],
603
- outputs=[status]
604
- )
605
-
606
- process_btn = gr.Button("βš™οΈ Process", elem_id="process-btn-url")
607
 
608
  with gr.Group(elem_classes="panel"):
609
  with gr.Row():
 
557
  with gr.Row():
558
  with gr.Column(scale=3, min_width=500):
559
  with gr.Group(elem_classes="panel"):
560
+ mode_toggle = gr.Radio(["πŸ“„ Upload Workbook", "πŸ“€ Upload Images"], value="πŸ“„ Upload Workbook", label="Select Input Method")
561
+ workbook_upload = gr.File(label="πŸ“‚ Upload .xlsx/.xlsm Workbook", file_types=['.xlsx', '.xlsm'], visible=True)
562
+ upload_box = gr.File(label="πŸ“ Upload Images", file_count="multiple", visible=False)
563
+ image_url_input = gr.Textbox( label="🌐 Paste Image URL", visible=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
 
565
  def toggle_inputs(choice):
566
  is_wb = choice.startswith("πŸ“„")
 
570
  gr.update(visible=not is_wb)
571
  )
572
 
573
+ mode_toggle.change( fn=toggle_inputs, inputs=[mode_toggle], outputs=[workbook_upload, upload_box, image_url_input] )
574
+ upload_box.change( lambda files: f"{len(files)} files ready." if files else "No files selected",inputs=[upload_box], outputs=[status] )
575
+ process_btn = gr.Button("βš™οΈ Process", elem_id="process-btn-url")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
576
 
577
  with gr.Group(elem_classes="panel"):
578
  with gr.Row():