guangkaixu commited on
Commit
3d2230a
1 Parent(s): cf2ec57
Files changed (1) hide show
  1. app.py +18 -74
app.py CHANGED
@@ -361,15 +361,6 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
361
  value="Estimate Depth", variant="primary"
362
  )
363
  depth_image_reset_btn = gr.Button(value="Reset")
364
- with gr.Accordion("Advanced options", open=False):
365
- image_processing_res = gr.Radio(
366
- [
367
- ("Native", 0),
368
- ("Recommended", 768),
369
- ],
370
- label="Processing resolution",
371
- value=default_image_processing_res,
372
- )
373
  with gr.Column():
374
  depth_image_output_slider = ImageSlider(
375
  label="Predicted depth of gray / color (red-near, blue-far)",
@@ -417,15 +408,6 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
417
  value="Estimate Normal", variant="primary"
418
  )
419
  normal_image_reset_btn = gr.Button(value="Reset")
420
- with gr.Accordion("Advanced options", open=False):
421
- image_processing_res = gr.Radio(
422
- [
423
- ("Native", 0),
424
- ("Recommended", 768),
425
- ],
426
- label="Processing resolution",
427
- value=default_image_processing_res,
428
- )
429
  with gr.Column():
430
  # normal_image_output_slider = ImageSlider(
431
  # label="Predicted surface normal",
@@ -477,15 +459,6 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
477
  value="Estimate Dichotomous Segmentation", variant="primary"
478
  )
479
  dis_image_reset_btn = gr.Button(value="Reset")
480
- with gr.Accordion("Advanced options", open=False):
481
- image_processing_res = gr.Radio(
482
- [
483
- ("Native", 0),
484
- ("Recommended", 768),
485
- ],
486
- label="Processing resolution",
487
- value=default_image_processing_res,
488
- )
489
  with gr.Column():
490
  # dis_image_output_slider = ImageSlider(
491
  # label="Predicted dichotomous image segmentation",
@@ -534,15 +507,6 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
534
  value="Estimate Matting", variant="primary"
535
  )
536
  matting_image_reset_btn = gr.Button(value="Reset")
537
- with gr.Accordion("Advanced options", open=False):
538
- image_processing_res = gr.Radio(
539
- [
540
- ("Native", 0),
541
- ("Recommended", 768),
542
- ],
543
- label="Processing resolution",
544
- value=default_image_processing_res,
545
- )
546
  with gr.Column():
547
  # matting_image_output_slider = ImageSlider(
548
  # label="Predicted matting image",
@@ -561,7 +525,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
561
  )
562
 
563
  filenames = []
564
- filenames.extend(["matting_%d.jpg" %(i+1) for i in range(4)])
565
  example_folder = os.path.join(os.path.dirname(__file__), "matting_images")
566
  # print(example_folder)
567
  Examples(
@@ -590,15 +554,6 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
590
  value="Estimate Segmentation", variant="primary"
591
  )
592
  seg_image_reset_btn = gr.Button(value="Reset")
593
- with gr.Accordion("Advanced options", open=False):
594
- image_processing_res = gr.Radio(
595
- [
596
- ("Native", 0),
597
- ("Recommended", 768),
598
- ],
599
- label="Processing resolution",
600
- value=default_image_processing_res,
601
- )
602
  with gr.Column():
603
  seg_image_output_slider = ImageSlider(
604
  label="Predicted segmentation results",
@@ -616,9 +571,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
616
  )
617
 
618
  filenames = []
619
- filenames.extend(["seg_anime_%d.jpg" %(i+1) for i in range(7)])
620
- filenames.extend(["seg_line_%d.jpg" %(i+1) for i in range(6)])
621
- filenames.extend(["seg_real_%d.jpg" %(i+1) for i in range(24)])
622
 
623
  example_folder = os.path.join(os.path.dirname(__file__), "seg_images")
624
  Examples(
@@ -643,19 +596,10 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
643
  # type="pil",
644
  )
645
  with gr.Row():
646
- disparity_image_submit_btn = gr.Button(
647
  value="Estimate Disparity", variant="primary"
648
  )
649
  disparity_image_reset_btn = gr.Button(value="Reset")
650
- with gr.Accordion("Advanced options", open=False):
651
- image_processing_res = gr.Radio(
652
- [
653
- ("Native", 0),
654
- ("Recommended", 768),
655
- ],
656
- label="Processing resolution",
657
- value=default_image_processing_res,
658
- )
659
  with gr.Column():
660
  disparity_image_output_slider = ImageSlider(
661
  label="Predicted disparity results",
@@ -673,9 +617,9 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
673
  )
674
 
675
  filenames = []
676
- filenames.extend(["disparity_anime_%d.jpg" %(i+1) for i in range(7)])
677
- filenames.extend(["disparity_line_%d.jpg" %(i+1) for i in range(6)])
678
- filenames.extend(["disparity_real_%d.jpg" %(i+1) for i in range(24)])
679
 
680
  example_folder = os.path.join(os.path.dirname(__file__), "depth_images")
681
  Examples(
@@ -703,7 +647,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
703
  fn=process_pipe_depth,
704
  inputs=[
705
  depth_image_input,
706
- image_processing_res,
707
  ],
708
  outputs=[depth_image_output_slider, depth_image_output_files],
709
  concurrency_limit=1,
@@ -721,7 +665,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
721
  depth_image_input,
722
  depth_image_output_slider,
723
  depth_image_output_files,
724
- image_processing_res,
725
  ],
726
  queue=False,
727
  )
@@ -736,7 +680,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
736
  fn=process_pipe_normal,
737
  inputs=[
738
  normal_image_input,
739
- image_processing_res,
740
  ],
741
  outputs=[normal_image_output, normal_image_output_files],
742
  concurrency_limit=1,
@@ -754,7 +698,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
754
  normal_image_input,
755
  normal_image_output,
756
  normal_image_output_files,
757
- image_processing_res,
758
  ],
759
  queue=False,
760
  )
@@ -769,7 +713,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
769
  fn=process_pipe_dis,
770
  inputs=[
771
  dis_image_input,
772
- image_processing_res,
773
  ],
774
  outputs=[dis_image_output, dis_image_output_files],
775
  concurrency_limit=1,
@@ -787,7 +731,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
787
  dis_image_input,
788
  dis_image_output,
789
  dis_image_output_files,
790
- image_processing_res,
791
  ],
792
  queue=False,
793
  )
@@ -802,7 +746,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
802
  fn=process_pipe_dis,
803
  inputs=[
804
  matting_image_input,
805
- image_processing_res,
806
  ],
807
  outputs=[matting_image_output, matting_image_output_files],
808
  concurrency_limit=1,
@@ -820,7 +764,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
820
  matting_image_input,
821
  matting_image_output,
822
  matting_image_output_files,
823
- image_processing_res,
824
  ],
825
  queue=False,
826
  )
@@ -835,7 +779,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
835
  fn=process_pipe_seg,
836
  inputs=[
837
  seg_image_input,
838
- image_processing_res,
839
  ],
840
  outputs=[seg_image_output_slider, seg_image_output_files],
841
  concurrency_limit=1,
@@ -853,7 +797,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
853
  seg_image_input,
854
  seg_image_output_slider,
855
  seg_image_output_files,
856
- image_processing_res,
857
  ],
858
  queue=False,
859
  )
@@ -868,7 +812,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
868
  fn=process_pipe_disparity,
869
  inputs=[
870
  disparity_image_input,
871
- image_processing_res,
872
  ],
873
  outputs=[disparity_image_output_slider, disparity_image_output_files],
874
  concurrency_limit=1,
@@ -886,7 +830,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis, pipe_matting, pipe_seg, p
886
  disparity_image_input,
887
  disparity_image_output_slider,
888
  disparity_image_output_files,
889
- image_processing_res,
890
  ],
891
  queue=False,
892
  )
 
361
  value="Estimate Depth", variant="primary"
362
  )
363
  depth_image_reset_btn = gr.Button(value="Reset")
 
 
 
 
 
 
 
 
 
364
  with gr.Column():
365
  depth_image_output_slider = ImageSlider(
366
  label="Predicted depth of gray / color (red-near, blue-far)",
 
408
  value="Estimate Normal", variant="primary"
409
  )
410
  normal_image_reset_btn = gr.Button(value="Reset")
 
 
 
 
 
 
 
 
 
411
  with gr.Column():
412
  # normal_image_output_slider = ImageSlider(
413
  # label="Predicted surface normal",
 
459
  value="Estimate Dichotomous Segmentation", variant="primary"
460
  )
461
  dis_image_reset_btn = gr.Button(value="Reset")
 
 
 
 
 
 
 
 
 
462
  with gr.Column():
463
  # dis_image_output_slider = ImageSlider(
464
  # label="Predicted dichotomous image segmentation",
 
507
  value="Estimate Matting", variant="primary"
508
  )
509
  matting_image_reset_btn = gr.Button(value="Reset")
 
 
 
 
 
 
 
 
 
510
  with gr.Column():
511
  # matting_image_output_slider = ImageSlider(
512
  # label="Predicted matting image",
 
525
  )
526
 
527
  filenames = []
528
+ filenames.extend(["matting_%d.jpg" %i for i in range(5)])
529
  example_folder = os.path.join(os.path.dirname(__file__), "matting_images")
530
  # print(example_folder)
531
  Examples(
 
554
  value="Estimate Segmentation", variant="primary"
555
  )
556
  seg_image_reset_btn = gr.Button(value="Reset")
 
 
 
 
 
 
 
 
 
557
  with gr.Column():
558
  seg_image_output_slider = ImageSlider(
559
  label="Predicted segmentation results",
 
571
  )
572
 
573
  filenames = []
574
+ filenames.extend(["seg_%d.jpg" %(i+1) for i in range(5)])
 
 
575
 
576
  example_folder = os.path.join(os.path.dirname(__file__), "seg_images")
577
  Examples(
 
596
  # type="pil",
597
  )
598
  with gr.Row():
599
+ disparity_imfage_submit_btn = gr.Button(
600
  value="Estimate Disparity", variant="primary"
601
  )
602
  disparity_image_reset_btn = gr.Button(value="Reset")
 
 
 
 
 
 
 
 
 
603
  with gr.Column():
604
  disparity_image_output_slider = ImageSlider(
605
  label="Predicted disparity results",
 
617
  )
618
 
619
  filenames = []
620
+ filenames.extend(["depth_anime_%d.jpg" %(i+1) for i in range(7)])
621
+ filenames.extend(["depth_line_%d.jpg" %(i+1) for i in range(6)])
622
+ filenames.extend(["depth_real_%d.jpg" %(i+1) for i in range(24)])
623
 
624
  example_folder = os.path.join(os.path.dirname(__file__), "depth_images")
625
  Examples(
 
647
  fn=process_pipe_depth,
648
  inputs=[
649
  depth_image_input,
650
+ default_image_processing_res,
651
  ],
652
  outputs=[depth_image_output_slider, depth_image_output_files],
653
  concurrency_limit=1,
 
665
  depth_image_input,
666
  depth_image_output_slider,
667
  depth_image_output_files,
668
+ default_image_processing_res,
669
  ],
670
  queue=False,
671
  )
 
680
  fn=process_pipe_normal,
681
  inputs=[
682
  normal_image_input,
683
+ default_image_processing_res,
684
  ],
685
  outputs=[normal_image_output, normal_image_output_files],
686
  concurrency_limit=1,
 
698
  normal_image_input,
699
  normal_image_output,
700
  normal_image_output_files,
701
+ default_image_processing_res,
702
  ],
703
  queue=False,
704
  )
 
713
  fn=process_pipe_dis,
714
  inputs=[
715
  dis_image_input,
716
+ default_image_processing_res,
717
  ],
718
  outputs=[dis_image_output, dis_image_output_files],
719
  concurrency_limit=1,
 
731
  dis_image_input,
732
  dis_image_output,
733
  dis_image_output_files,
734
+ default_image_processing_res,
735
  ],
736
  queue=False,
737
  )
 
746
  fn=process_pipe_dis,
747
  inputs=[
748
  matting_image_input,
749
+ default_image_processing_res,
750
  ],
751
  outputs=[matting_image_output, matting_image_output_files],
752
  concurrency_limit=1,
 
764
  matting_image_input,
765
  matting_image_output,
766
  matting_image_output_files,
767
+ default_image_processing_res,
768
  ],
769
  queue=False,
770
  )
 
779
  fn=process_pipe_seg,
780
  inputs=[
781
  seg_image_input,
782
+ default_image_processing_res,
783
  ],
784
  outputs=[seg_image_output_slider, seg_image_output_files],
785
  concurrency_limit=1,
 
797
  seg_image_input,
798
  seg_image_output_slider,
799
  seg_image_output_files,
800
+ default_image_processing_res,
801
  ],
802
  queue=False,
803
  )
 
812
  fn=process_pipe_disparity,
813
  inputs=[
814
  disparity_image_input,
815
+ default_image_processing_res,
816
  ],
817
  outputs=[disparity_image_output_slider, disparity_image_output_files],
818
  concurrency_limit=1,
 
830
  disparity_image_input,
831
  disparity_image_output_slider,
832
  disparity_image_output_files,
833
+ default_image_processing_res,
834
  ],
835
  queue=False,
836
  )