guoshengjian commited on
Commit
7179db2
Β·
1 Parent(s): 1a8600d

refactor app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -14
app.py CHANGED
@@ -551,9 +551,7 @@ with gr.Blocks(css=CSS, title=TITLE, theme=paddle_theme) as demo:
551
  scale=0,
552
  elem_classes=["tight-spacing"],
553
  )
554
- with gr.Column(
555
- visible=True
556
- ) as Module_Options:
557
  use_doc_orientation_classify_md = gr.Markdown(
558
  "### Using the document image orientation classification module",
559
  elem_id="use_doc_orientation_classify_md",
@@ -587,9 +585,7 @@ with gr.Blocks(css=CSS, title=TITLE, theme=paddle_theme) as demo:
587
  show_label=False,
588
  elem_id="use_textline_orientation_rd",
589
  )
590
- with gr.Column(
591
- visible=False
592
- ) as Text_detection_Options:
593
  text_det_limit_type_md = gr.Markdown(
594
  "### Image side length restriction type for text detection",
595
  elem_id="text_det_limit_type_md",
@@ -672,7 +668,6 @@ with gr.Blocks(css=CSS, title=TITLE, theme=paddle_theme) as demo:
672
  "πŸš€ Parse Document", elem_id="analyze-btn", variant="primary"
673
  )
674
 
675
-
676
  # Results display section
677
  with gr.Column(scale=7):
678
  gr.Markdown("### Results", elem_classes="custom-markdown")
@@ -779,11 +774,11 @@ with gr.Blocks(css=CSS, title=TITLE, theme=paddle_theme) as demo:
779
  )
780
  )
781
  download_all_btn = gr.Button(
782
- "πŸ“¦ Download Full Results (ZIP)",
783
- elem_id="unzip-btn",
784
- variant="primary",
785
- visible=False,
786
- )
787
  # # Navigation bar
788
  with gr.Column(elem_classes=["nav-bar"]):
789
  gr.HTML(
@@ -817,7 +812,14 @@ with gr.Blocks(css=CSS, title=TITLE, theme=paddle_theme) as demo:
817
  """,
818
  )
819
  process_btn.click(
820
- toggle_spinner, outputs=[loading_spinner, prepare_spinner, download_file, tabs, download_all_btn]
 
 
 
 
 
 
 
821
  ).then(
822
  process_file,
823
  inputs=[
@@ -840,7 +842,10 @@ with gr.Blocks(css=CSS, title=TITLE, theme=paddle_theme) as demo:
840
  update_display,
841
  inputs=[results_state],
842
  outputs=overall_ocr_res_images + output_json_list + gallery_list,
843
- ).then(lambda: gr.update(visible=True), outputs=download_all_btn)
 
 
 
844
  gallery_ocr_det.select(update_image, outputs=overall_ocr_res_images)
845
 
846
  download_all_btn.click(
 
551
  scale=0,
552
  elem_classes=["tight-spacing"],
553
  )
554
+ with gr.Column(visible=True) as Module_Options:
 
 
555
  use_doc_orientation_classify_md = gr.Markdown(
556
  "### Using the document image orientation classification module",
557
  elem_id="use_doc_orientation_classify_md",
 
585
  show_label=False,
586
  elem_id="use_textline_orientation_rd",
587
  )
588
+ with gr.Column(visible=False) as Text_detection_Options:
 
 
589
  text_det_limit_type_md = gr.Markdown(
590
  "### Image side length restriction type for text detection",
591
  elem_id="text_det_limit_type_md",
 
668
  "πŸš€ Parse Document", elem_id="analyze-btn", variant="primary"
669
  )
670
 
 
671
  # Results display section
672
  with gr.Column(scale=7):
673
  gr.Markdown("### Results", elem_classes="custom-markdown")
 
774
  )
775
  )
776
  download_all_btn = gr.Button(
777
+ "πŸ“¦ Download Full Results (ZIP)",
778
+ elem_id="unzip-btn",
779
+ variant="primary",
780
+ visible=False,
781
+ )
782
  # # Navigation bar
783
  with gr.Column(elem_classes=["nav-bar"]):
784
  gr.HTML(
 
812
  """,
813
  )
814
  process_btn.click(
815
+ toggle_spinner,
816
+ outputs=[
817
+ loading_spinner,
818
+ prepare_spinner,
819
+ download_file,
820
+ tabs,
821
+ download_all_btn,
822
+ ],
823
  ).then(
824
  process_file,
825
  inputs=[
 
842
  update_display,
843
  inputs=[results_state],
844
  outputs=overall_ocr_res_images + output_json_list + gallery_list,
845
+ ).success(
846
+ lambda: gr.update(visible=True), outputs=download_all_btn
847
+ )
848
+
849
  gallery_ocr_det.select(update_image, outputs=overall_ocr_res_images)
850
 
851
  download_all_btn.click(