VisionLanguageGroup commited on
Commit
e238bb7
Β·
1 Parent(s): 86072ea

update style

Browse files
Files changed (1) hide show
  1. app.py +265 -44
app.py CHANGED
@@ -897,44 +897,265 @@ example_images_cnt = [f for f in glob("example_imgs/cnt/*")]
897
  example_tracking_zips = [f for f in glob("example_imgs/tra/*.zip")]
898
 
899
  # ===== Gradio UI =====
900
- with gr.Blocks(
901
- title="Microscopy Analysis Suite",
902
- theme=gr.themes.Soft(),
903
- css="""
904
- .tabs button {
905
- font-size: 18px !important;
906
- font-weight: 600 !important;
907
- padding: 12px 20px !important;
908
- }
909
- .uniform-height {
910
- height: 500px !important;
911
- display: flex !important;
912
- align-items: center !important;
913
- justify-content: center !important;
914
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
915
 
916
- .uniform-height img,
917
- .uniform-height canvas {
918
- max-height: 500px !important;
919
- object-fit: contain !important;
920
- }
921
-
922
- #density_map_output {
923
- height: 500px !important;
924
- }
925
-
926
- #density_map_output .image-container {
927
- height: 500px !important;
928
- }
929
-
930
- #density_map_output img {
931
- height: 480px !important;
932
- width: auto !important;
933
- max-width: 90% !important;
934
- object-fit: contain !important;
935
- }
936
- """
937
- ) as demo:
938
  gr.Markdown(
939
  """
940
  # πŸ”¬ MicroscopyMatching: Microscopy Image Analysis Suite
@@ -946,7 +1167,7 @@ with gr.Blocks(
946
 
947
  ### πŸ’‘ Technical Details:
948
 
949
- **MicroscopyMatching** - A general-purpose microscopy image analysis toolkit based on Stable Diffusion
950
 
951
  ### πŸ“’ Note:
952
 
@@ -972,7 +1193,7 @@ with gr.Blocks(
972
  1. Upload an image or select an example image (supports various formats: .png, .jpg, .tif)
973
  2. (Optional) Specify a target object with a bounding box and select "Yes", or click "Run Segmentation" directly
974
  3. Click "Run Segmentation"
975
- 4. View the segmentation results, download the original predicted mask (.tif format); if needed, click "Clear Selection" to choose a new image
976
 
977
  🀘 Rate and submit feedback to help us improve the model!
978
  """
@@ -1024,7 +1245,7 @@ with gr.Blocks(
1024
  maximum=1.0,
1025
  step=0.05,
1026
  value=0.5,
1027
- label="🎚️ Overlay Opacity"
1028
  )
1029
 
1030
  # Download Original Prediction
@@ -1157,7 +1378,7 @@ with gr.Blocks(
1157
  1. Upload an image or select an example image (supports multiple formats: .png, .jpg, .tif)
1158
  2. (Optional) Specify a target object with a bounding box and select "Yes", or click "Run Counting" directly
1159
  3. Click "Run Counting"
1160
- 4. View the density map, download the original prediction (.npy format); if needed, click "Clear Selection" to choose a new image to run
1161
 
1162
  🀘 Rate and submit feedback to help us improve the model!
1163
  """
@@ -1215,7 +1436,7 @@ with gr.Blocks(
1215
  maximum=1.0,
1216
  step=0.05,
1217
  value=0.3,
1218
- label="🎚️ Heatmap Opacity"
1219
  )
1220
  count_status = gr.Textbox(
1221
  label="πŸ“Š Statistics",
@@ -1351,7 +1572,7 @@ with gr.Blocks(
1351
  1. Upload a ZIP file or select from the example library. The ZIP should contain a sequence of TIF images named in chronological order (e.g., t000.tif, t001.tif...)
1352
  2. (Optional) Specify a target object with a bounding box on the first frame and select "Yes", or click "Run Tracking" directly
1353
  3. Click "Run Tracking"
1354
- 4. Download the CTC format results; if needed, click "Clear Selection" to choose a new ZIP file to run
1355
 
1356
  🀘 Rate and submit feedback to help us improve the model!
1357
 
@@ -1413,7 +1634,7 @@ with gr.Blocks(
1413
  maximum=1.0,
1414
  step=0.05,
1415
  value=0.3,
1416
- label="🎚️ Overlay Opacity"
1417
  )
1418
 
1419
  track_output = gr.Textbox(
 
897
  example_tracking_zips = [f for f in glob("example_imgs/tra/*.zip")]
898
 
899
  # ===== Gradio UI =====
900
+ CSS = """
901
+ /* ── Layout ──────────────────────────────────────────── */
902
+ .gradio-container {
903
+ max-width: 1380px !important;
904
+ margin: 0 auto !important;
905
+ font-family: 'Inter', 'Segoe UI', system-ui, sans-serif !important;
906
+ }
907
+
908
+ /* ── Header markdown polish ───────────────────────────── */
909
+ .gradio-container .prose h1 {
910
+ font-size: 2rem !important;
911
+ font-weight: 700 !important;
912
+ color: #1e293b !important;
913
+ letter-spacing: -0.5px !important;
914
+ margin-bottom: 10px !important;
915
+ }
916
+ .gradio-container .prose h3 {
917
+ font-size: 1rem !important;
918
+ font-weight: 600 !important;
919
+ color: #0284c7 !important;
920
+ margin-top: 14px !important;
921
+ margin-bottom: 4px !important;
922
+ }
923
+ .gradio-container .prose p {
924
+ margin-top: 4px !important;
925
+ margin-bottom: 6px !important;
926
+ color: #475569 !important;
927
+ line-height: 1.7 !important;
928
+ }
929
+ .gradio-container .prose ul,
930
+ .gradio-container .prose ol {
931
+ margin-top: 4px !important;
932
+ margin-bottom: 6px !important;
933
+ }
934
+ .gradio-container .prose li {
935
+ color: #475569 !important;
936
+ line-height: 1.7 !important;
937
+ }
938
+
939
+ /* ── Top-level header section ─────────────────────────── */
940
+ .gradio-container > .gap > .prose:first-child {
941
+ background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f0fdf4 100%) !important;
942
+ border: 1px solid #bae6fd !important;
943
+ border-radius: 16px !important;
944
+ padding: 28px 36px !important;
945
+ margin-bottom: 20px !important;
946
+ box-shadow: 0 4px 20px rgba(14,165,233,0.08) !important;
947
+ }
948
+
949
+ /* ── Tabs ────────────────────────────────────────────── */
950
+ .tabs > .tab-nav {
951
+ border-bottom: 2px solid #e2e8f0 !important;
952
+ margin-bottom: 20px !important;
953
+ gap: 4px !important;
954
+ }
955
+ .tabs button {
956
+ font-size: 15px !important;
957
+ font-weight: 600 !important;
958
+ padding: 11px 24px !important;
959
+ border-radius: 8px 8px 0 0 !important;
960
+ color: #64748b !important;
961
+ transition: color 0.15s, background 0.15s !important;
962
+ }
963
+ .tabs button:hover {
964
+ color: #0ea5e9 !important;
965
+ background: #f0f9ff !important;
966
+ }
967
+ .tabs button.selected {
968
+ color: #0284c7 !important;
969
+ border-bottom: 3px solid #0284c7 !important;
970
+ background: transparent !important;
971
+ }
972
+
973
+ /* ── Buttons ─────────────────────────────────────────── */
974
+ button.primary {
975
+ background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%) !important;
976
+ border: none !important;
977
+ border-radius: 10px !important;
978
+ color: #fff !important;
979
+ font-weight: 600 !important;
980
+ font-size: 15px !important;
981
+ box-shadow: 0 3px 12px rgba(14,165,233,0.35) !important;
982
+ transition: transform 0.12s ease, box-shadow 0.15s ease !important;
983
+ }
984
+ button.primary:hover {
985
+ transform: translateY(-2px) !important;
986
+ box-shadow: 0 6px 20px rgba(14,165,233,0.45) !important;
987
+ }
988
+ button.secondary {
989
+ border-radius: 10px !important;
990
+ font-weight: 500 !important;
991
+ border: 1.5px solid #cbd5e1 !important;
992
+ color: #475569 !important;
993
+ transition: border-color 0.12s, color 0.12s, background 0.12s !important;
994
+ }
995
+ button.secondary:hover {
996
+ border-color: #94a3b8 !important;
997
+ color: #1e293b !important;
998
+ background: #f8fafc !important;
999
+ }
1000
+
1001
+ /* ── Blocks and panels ───────────────────────────────── */
1002
+ .gradio-container .block { border-radius: 14px !important; }
1003
+ .gradio-container .gr-form,
1004
+ .gradio-container .gr-box,
1005
+ .gradio-container .gr-panel {
1006
+ border-radius: 14px !important;
1007
+ border-color: #e2e8f0 !important;
1008
+ }
1009
+
1010
+ /* ── Labels ──────────────────────────────────────────── */
1011
+ label { font-weight: 500 !important; color: #374151 !important; }
1012
+
1013
+ /* ── Image output ────────────────────────────────────── */
1014
+ .uniform-height {
1015
+ height: 480px !important;
1016
+ display: flex !important;
1017
+ align-items: center !important;
1018
+ justify-content: center !important;
1019
+ border-radius: 12px !important;
1020
+ background: #f8fafc !important;
1021
+ }
1022
+ .uniform-height img, .uniform-height canvas {
1023
+ max-height: 480px !important;
1024
+ object-fit: contain !important;
1025
+ }
1026
+
1027
+ /* ── Density map output ──────────────────────────────── */
1028
+ #density_map_output { height: 480px !important; }
1029
+ #density_map_output .image-container { height: 480px !important; }
1030
+ #density_map_output img {
1031
+ height: 460px !important;
1032
+ width: auto !important;
1033
+ max-width: 95% !important;
1034
+ object-fit: contain !important;
1035
+ }
1036
+
1037
+ /* ── Tab content description markdown ───────────────── */
1038
+ .tabitem .prose h2 {
1039
+ font-size: 1.3rem !important;
1040
+ font-weight: 700 !important;
1041
+ color: #1e293b !important;
1042
+ margin-top: 0 !important;
1043
+ margin-bottom: 10px !important;
1044
+ padding-bottom: 8px !important;
1045
+ border-bottom: 2px solid #e0f2fe !important;
1046
+ }
1047
+ .tabitem .prose:nth-child(2) {
1048
+ background: #f8fafc !important;
1049
+ border: 1px solid #e2e8f0 !important;
1050
+ border-radius: 10px !important;
1051
+ padding: 12px 18px !important;
1052
+ margin-bottom: 16px !important;
1053
+ }
1054
+ .tabitem .prose:nth-child(2) p,
1055
+ .tabitem .prose:nth-child(2) li {
1056
+ font-size: 0.91rem !important;
1057
+ color: #64748b !important;
1058
+ }
1059
+ .tabitem .prose:nth-child(2) strong {
1060
+ color: #0f172a !important;
1061
+ }
1062
+
1063
+ /* ════════════════════════════════════════════════════════
1064
+ DARK MODE (.dark is added to <html> by Gradio)
1065
+ ════════════════════════════════════════════════════════ */
1066
+
1067
+ /* ── Header text ─────────────────────────────────────── */
1068
+ .dark .gradio-container .prose h1 {
1069
+ color: #e2e8f0 !important;
1070
+ }
1071
+ .dark .gradio-container .prose h3 {
1072
+ color: #38bdf8 !important;
1073
+ }
1074
+ .dark .gradio-container .prose p,
1075
+ .dark .gradio-container .prose li {
1076
+ color: #94a3b8 !important;
1077
+ }
1078
+
1079
+ /* ── Top-level header card ───────────────────────────── */
1080
+ .dark .gradio-container > .gap > .prose:first-child {
1081
+ background: linear-gradient(135deg, #0c1a2e 0%, #0f2942 50%, #0d1f12 100%) !important;
1082
+ border-color: #1e3a5f !important;
1083
+ box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
1084
+ }
1085
+
1086
+ /* ── Tabs ────────────────────────────────────────────── */
1087
+ .dark .tabs > .tab-nav {
1088
+ border-bottom-color: #334155 !important;
1089
+ }
1090
+ .dark .tabs button {
1091
+ color: #94a3b8 !important;
1092
+ }
1093
+ .dark .tabs button:hover {
1094
+ color: #38bdf8 !important;
1095
+ background: rgba(56,189,248,0.08) !important;
1096
+ }
1097
+ .dark .tabs button.selected {
1098
+ color: #38bdf8 !important;
1099
+ border-bottom-color: #38bdf8 !important;
1100
+ }
1101
+
1102
+ /* ── Buttons ─────────────────────────────────────────── */
1103
+ .dark button.secondary {
1104
+ border-color: #475569 !important;
1105
+ color: #94a3b8 !important;
1106
+ background: transparent !important;
1107
+ }
1108
+ .dark button.secondary:hover {
1109
+ border-color: #64748b !important;
1110
+ color: #e2e8f0 !important;
1111
+ background: rgba(255,255,255,0.05) !important;
1112
+ }
1113
+
1114
+ /* ── Blocks / panels ─────────────────────────────────── */
1115
+ .dark .gradio-container .gr-form,
1116
+ .dark .gradio-container .gr-box,
1117
+ .dark .gradio-container .gr-panel {
1118
+ border-color: #334155 !important;
1119
+ }
1120
+
1121
+ /* ── Labels ──────────────────────────────────────────── */
1122
+ .dark label {
1123
+ color: #cbd5e1 !important;
1124
+ }
1125
+
1126
+ /* ── Image output area ───────────────────────────────── */
1127
+ .dark .uniform-height {
1128
+ background: #1e293b !important;
1129
+ }
1130
+
1131
+ /* ── Tab content markdown ────────────────────────────── */
1132
+ .dark .tabitem .prose h2 {
1133
+ color: #e2e8f0 !important;
1134
+ border-bottom-color: #1e3a5f !important;
1135
+ }
1136
+ .dark .tabitem .prose:nth-child(2) {
1137
+ background: #1e293b !important;
1138
+ border-color: #334155 !important;
1139
+ }
1140
+ .dark .tabitem .prose:nth-child(2) p,
1141
+ .dark .tabitem .prose:nth-child(2) li {
1142
+ color: #94a3b8 !important;
1143
+ }
1144
+ .dark .tabitem .prose:nth-child(2) strong {
1145
+ color: #e2e8f0 !important;
1146
+ }
1147
+ """
1148
 
1149
+ with gr.Blocks(
1150
+ title="Microscopy Analysis Suite",
1151
+ theme=gr.themes.Soft(
1152
+ primary_hue=gr.themes.colors.sky,
1153
+ secondary_hue=gr.themes.colors.slate,
1154
+ neutral_hue=gr.themes.colors.slate,
1155
+ font=gr.themes.GoogleFont("Inter"),
1156
+ ),
1157
+ css=CSS,
1158
+ ) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
1159
  gr.Markdown(
1160
  """
1161
  # πŸ”¬ MicroscopyMatching: Microscopy Image Analysis Suite
 
1167
 
1168
  ### πŸ’‘ Technical Details:
1169
 
1170
+ **MicroscopyMatching** - A general-purpose microscopy image analysis toolkit based on pre-trained Latent Diffusion Model
1171
 
1172
  ### πŸ“’ Note:
1173
 
 
1193
  1. Upload an image or select an example image (supports various formats: .png, .jpg, .tif)
1194
  2. (Optional) Specify a target object with a bounding box and select "Yes", or click "Run Segmentation" directly
1195
  3. Click "Run Segmentation"
1196
+ 4. View the segmentation results (you can adjust the overlay opacity by sliding the opacity bar below the visualization), download the original predicted mask (.tif format); if needed, click "Clear Selection" to choose a new image
1197
 
1198
  🀘 Rate and submit feedback to help us improve the model!
1199
  """
 
1245
  maximum=1.0,
1246
  step=0.05,
1247
  value=0.5,
1248
+ label="πŸͺ„ Overlay Opacity"
1249
  )
1250
 
1251
  # Download Original Prediction
 
1378
  1. Upload an image or select an example image (supports multiple formats: .png, .jpg, .tif)
1379
  2. (Optional) Specify a target object with a bounding box and select "Yes", or click "Run Counting" directly
1380
  3. Click "Run Counting"
1381
+ 4. View the density map (you can adjust the density opacity by sliding the opacity bar below the visualization), download the original prediction (.npy format); if needed, click "Clear Selection" to choose a new image to run
1382
 
1383
  🀘 Rate and submit feedback to help us improve the model!
1384
  """
 
1436
  maximum=1.0,
1437
  step=0.05,
1438
  value=0.3,
1439
+ label="πŸͺ„ Density Opacity"
1440
  )
1441
  count_status = gr.Textbox(
1442
  label="πŸ“Š Statistics",
 
1572
  1. Upload a ZIP file or select from the example library. The ZIP should contain a sequence of TIF images named in chronological order (e.g., t000.tif, t001.tif...)
1573
  2. (Optional) Specify a target object with a bounding box on the first frame and select "Yes", or click "Run Tracking" directly
1574
  3. Click "Run Tracking"
1575
+ 4. View the tracking results (you can adjust the overlay opacity by sliding the opacity bar below the visualization), download the CTC format results; if needed, click "Clear Selection" to choose a new ZIP file to run
1576
 
1577
  🀘 Rate and submit feedback to help us improve the model!
1578
 
 
1634
  maximum=1.0,
1635
  step=0.05,
1636
  value=0.3,
1637
+ label="πŸͺ„ Overlay Opacity"
1638
  )
1639
 
1640
  track_output = gr.Textbox(