Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
562 |
-
|
563 |
-
|
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 |
-
|
590 |
-
|
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():
|