Yiming-M commited on
Commit
4a2b023
·
1 Parent(s): fb20bf9

2025-08-01 09:34 🚀

Browse files
Files changed (1) hide show
  1. app.py +53 -69
app.py CHANGED
@@ -576,7 +576,11 @@ select option[value*="━━━━━━"] {
576
  position: static !important;
577
  }
578
 
579
- .gr-row:nth-of-type(3) .gr-button {
 
 
 
 
580
  position: static !important;
581
  bottom: auto !important;
582
  left: auto !important;
@@ -615,7 +619,11 @@ select option[value*="━━━━━━"] {
615
  position: static !important;
616
  }
617
 
618
- .gr-row:nth-of-type(3) .gr-button {
 
 
 
 
619
  position: static !important;
620
  bottom: auto !important;
621
  left: auto !important;
@@ -665,7 +673,11 @@ select option[value*="━━━━━━"] {
665
  position: static !important;
666
  }
667
 
668
- .gr-row:nth-of-type(3) .gr-button {
 
 
 
 
669
  position: static !important;
670
  bottom: auto !important;
671
  left: auto !important;
@@ -796,13 +808,13 @@ select option[value*="━━━━━━"] {
796
  transform: translateY(-2px) !important;
797
  }
798
 
799
- /* 确保第二行组件等高 */
800
  .gr-row:nth-of-type(2) .gr-group {
801
- height: 240px !important;
802
- min-height: 240px !important;
803
  display: flex !important;
804
  flex-direction: column !important;
805
- justify-content: space-between !important;
806
  }
807
 
808
  .gr-row:nth-of-type(2) .gr-group > * {
@@ -823,10 +835,10 @@ select option[value*="━━━━━━"] {
823
  max-height: 80px !important;
824
  }
825
 
826
- /* 确保第三行组件等高 */
827
  .gr-row:nth-of-type(3) .gr-group {
828
- height: 480px !important;
829
- min-height: 480px !important;
830
  display: flex !important;
831
  flex-direction: column !important;
832
  justify-content: flex-start !important;
@@ -834,18 +846,18 @@ select option[value*="━━━━━━"] {
834
 
835
  /* 第三行的图像容器统一高度 */
836
  .gr-row:nth-of-type(3) .gr-image {
837
- height: 380px !important;
838
- min-height: 380px !important;
839
- max-height: 380px !important;
840
- flex: 0 0 380px !important;
841
  }
842
 
843
- /* 第三行的按钮固定在底部 */
844
- .gr-row:nth-of-type(3) .gr-group {
845
  position: relative !important;
846
  }
847
 
848
- .gr-row:nth-of-type(3) .gr-button {
849
  position: absolute !important;
850
  bottom: 24px !important;
851
  left: 24px !important;
@@ -860,13 +872,9 @@ select option[value*="━━━━━━"] {
860
  margin-bottom: 16px !important;
861
  }
862
 
863
- /* 第二行特殊布局调整 */
864
- .gr-row:nth-of-type(2) .gr-column:first-child {
865
- padding-right: 12px !important;
866
- }
867
-
868
- .gr-row:nth-of-type(2) .gr-column:last-child {
869
- padding-left: 12px !important;
870
  }
871
 
872
  /* 标签美化 */
@@ -924,25 +932,7 @@ select option[value*="━━━━━━"] {
924
  height: 100% !important;
925
  }
926
 
927
- /* 第二行内部子行等高处理 */
928
- .gr-row:nth-of-type(2) .gr-group .gr-row {
929
- height: 100% !important;
930
- align-items: stretch !important;
931
- flex: 1 !important;
932
- }
933
-
934
- .gr-row:nth-of-type(2) .gr-group .gr-row .gr-column {
935
- display: flex !important;
936
- flex-direction: column !important;
937
- justify-content: space-between !important;
938
- height: 100% !important;
939
- }
940
-
941
- /* 第二行内部markdown标题固定高度 */
942
- .gr-row:nth-of-type(2) .gr-group .gr-markdown {
943
- flex: 0 0 auto !important;
944
- margin-bottom: 16px !important;
945
- }
946
 
947
  /* 统计信息卡片美化 */
948
  .gr-textbox[label*="Count"] {
@@ -1020,34 +1010,31 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as d
1020
  Choose from different model variants: **ZIP-B** (Base), **ZIP-S** (Small), **ZIP-T** (Tiny), **ZIP-N** (Nano), **ZIP-P** (Pico)
1021
  """)
1022
 
1023
- # 第二行:模型配置区域(2/3宽度)和预测结果(1/3宽度)
1024
  with gr.Row():
1025
- with gr.Column(scale=2):
 
 
 
 
 
 
 
 
 
1026
  with gr.Group():
1027
- gr.Markdown("### 🤖 Model Configuration")
1028
- with gr.Row():
1029
- with gr.Column(scale=1):
1030
- model_dropdown = gr.Dropdown(
1031
- choices=pretrained_models,
1032
- value="ZIP-B @ NWPU-Crowd @ MAE",
1033
- label="🎛️ Select Model & Dataset",
1034
- info="Choose model variant, dataset, and evaluation metric"
1035
- )
1036
-
1037
- with gr.Column(scale=1):
1038
- model_status = gr.Textbox(
1039
- label="📊 Model Status",
1040
- value="🔄 No model loaded",
1041
- interactive=False,
1042
- elem_classes=["status-display"],
1043
- lines=3
1044
- )
1045
 
1046
  with gr.Column(scale=1):
1047
  with gr.Group():
1048
- gr.Markdown("### 🧙 Predicted Count")
1049
  output_text = gr.Textbox(
1050
- label="Result",
1051
  value="",
1052
  interactive=False,
1053
  info="Total number of people detected",
@@ -1058,9 +1045,8 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as d
1058
  with gr.Row():
1059
  with gr.Column(scale=1):
1060
  with gr.Group():
1061
- gr.Markdown("### 📸 Image Input")
1062
  input_img = gr.Image(
1063
- label="🖼️ Upload Image",
1064
  sources=["upload", "clipboard"],
1065
  type="pil",
1066
  height=400
@@ -1073,7 +1059,6 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as d
1073
 
1074
  with gr.Column(scale=1):
1075
  with gr.Group():
1076
- gr.Markdown("### 📊 Main Results")
1077
  output_den_map = gr.Image(
1078
  label="🎯 Predicted Density Map",
1079
  type="pil",
@@ -1082,7 +1067,6 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), title="ZIP Crowd Counting") as d
1082
 
1083
  with gr.Column(scale=1):
1084
  with gr.Group():
1085
- gr.Markdown("### 🔥 Hotspots")
1086
  output_lambda_map = gr.Image(
1087
  label="📈 Lambda Map",
1088
  type="pil",
 
576
  position: static !important;
577
  }
578
 
579
+ .gr-row:nth-of-type(3) .gr-column:first-child .gr-group {
580
+ position: static !important;
581
+ }
582
+
583
+ .gr-row:nth-of-type(3) .gr-column:first-child .gr-button {
584
  position: static !important;
585
  bottom: auto !important;
586
  left: auto !important;
 
619
  position: static !important;
620
  }
621
 
622
+ .gr-row:nth-of-type(3) .gr-column:first-child .gr-group {
623
+ position: static !important;
624
+ }
625
+
626
+ .gr-row:nth-of-type(3) .gr-column:first-child .gr-button {
627
  position: static !important;
628
  bottom: auto !important;
629
  left: auto !important;
 
673
  position: static !important;
674
  }
675
 
676
+ .gr-row:nth-of-type(3) .gr-column:first-child .gr-group {
677
+ position: static !important;
678
+ }
679
+
680
+ .gr-row:nth-of-type(3) .gr-column:first-child .gr-button {
681
  position: static !important;
682
  bottom: auto !important;
683
  left: auto !important;
 
808
  transform: translateY(-2px) !important;
809
  }
810
 
811
+ /* 确保第二行组件等高 - 重新调整为三列等宽 */
812
  .gr-row:nth-of-type(2) .gr-group {
813
+ height: 180px !important;
814
+ min-height: 180px !important;
815
  display: flex !important;
816
  flex-direction: column !important;
817
+ justify-content: center !important;
818
  }
819
 
820
  .gr-row:nth-of-type(2) .gr-group > * {
 
835
  max-height: 80px !important;
836
  }
837
 
838
+ /* 确保第三行组件等高 - 重新调整高度 */
839
  .gr-row:nth-of-type(3) .gr-group {
840
+ height: 520px !important;
841
+ min-height: 520px !important;
842
  display: flex !important;
843
  flex-direction: column !important;
844
  justify-content: flex-start !important;
 
846
 
847
  /* 第三行的图像容器统一高度 */
848
  .gr-row:nth-of-type(3) .gr-image {
849
+ height: 400px !important;
850
+ min-height: 400px !important;
851
+ max-height: 400px !important;
852
+ flex: 0 0 400px !important;
853
  }
854
 
855
+ /* 第三行的按钮固定在底部 - 只对第一列(Image Input)应用 */
856
+ .gr-row:nth-of-type(3) .gr-column:first-child .gr-group {
857
  position: relative !important;
858
  }
859
 
860
+ .gr-row:nth-of-type(3) .gr-column:first-child .gr-button {
861
  position: absolute !important;
862
  bottom: 24px !important;
863
  left: 24px !important;
 
872
  margin-bottom: 16px !important;
873
  }
874
 
875
+ /* 第二行特殊布局调整 - 移除,现在是三列等宽 */
876
+ .gr-row:nth-of-type(2) .gr-column {
877
+ padding: 0 8px !important;
 
 
 
 
878
  }
879
 
880
  /* 标签美化 */
 
932
  height: 100% !important;
933
  }
934
 
935
+ /* 第二行内部子行等高处理 - 移除,现在不需要内部子行 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
 
937
  /* 统计信息卡片美化 */
938
  .gr-textbox[label*="Count"] {
 
1010
  Choose from different model variants: **ZIP-B** (Base), **ZIP-S** (Small), **ZIP-T** (Tiny), **ZIP-N** (Nano), **ZIP-P** (Pico)
1011
  """)
1012
 
1013
+ # 第二行:模型配置、状态和预测结果(三列等宽)
1014
  with gr.Row():
1015
+ with gr.Column(scale=1):
1016
+ with gr.Group():
1017
+ model_dropdown = gr.Dropdown(
1018
+ choices=pretrained_models,
1019
+ value="ZIP-B @ NWPU-Crowd @ MAE",
1020
+ label="🎛️ Select Model & Dataset",
1021
+ info="Choose model variant, dataset, and evaluation metric"
1022
+ )
1023
+
1024
+ with gr.Column(scale=1):
1025
  with gr.Group():
1026
+ model_status = gr.Textbox(
1027
+ label="📊 Model Status",
1028
+ value="🔄 No model loaded",
1029
+ interactive=False,
1030
+ elem_classes=["status-display"],
1031
+ lines=3
1032
+ )
 
 
 
 
 
 
 
 
 
 
 
1033
 
1034
  with gr.Column(scale=1):
1035
  with gr.Group():
 
1036
  output_text = gr.Textbox(
1037
+ label="🧙 Predicted Count",
1038
  value="",
1039
  interactive=False,
1040
  info="Total number of people detected",
 
1045
  with gr.Row():
1046
  with gr.Column(scale=1):
1047
  with gr.Group():
 
1048
  input_img = gr.Image(
1049
+ label="📸 Upload Image",
1050
  sources=["upload", "clipboard"],
1051
  type="pil",
1052
  height=400
 
1059
 
1060
  with gr.Column(scale=1):
1061
  with gr.Group():
 
1062
  output_den_map = gr.Image(
1063
  label="🎯 Predicted Density Map",
1064
  type="pil",
 
1067
 
1068
  with gr.Column(scale=1):
1069
  with gr.Group():
 
1070
  output_lambda_map = gr.Image(
1071
  label="📈 Lambda Map",
1072
  type="pil",