Spaces:
Sleeping
Sleeping
chengwang96 commited on
Commit ·
3222a03
1
Parent(s): 54acf57
update UI
Browse files
app.py
CHANGED
|
@@ -132,117 +132,186 @@ css = """
|
|
| 132 |
margin-top: 18px;
|
| 133 |
letter-spacing: 2px;
|
| 134 |
}
|
| 135 |
-
|
| 136 |
.blue-dash-border {
|
| 137 |
border: 2.5px dashed #164fa0 !important;
|
| 138 |
border-radius: 22px !important;
|
| 139 |
padding: 0 !important;
|
| 140 |
-
margin-bottom:
|
| 141 |
box-sizing: border-box;
|
| 142 |
}
|
|
|
|
| 143 |
.big-group {
|
| 144 |
-
background: #
|
| 145 |
border: 2px solid #e0e2e5 !important;
|
| 146 |
border-radius: 18px !important;
|
| 147 |
padding: 28px 18px 24px 18px !important;
|
| 148 |
margin: 16px !important;
|
| 149 |
box-shadow: 0 3px 12px 2px rgba(60,64,67,.14);
|
| 150 |
}
|
|
|
|
| 151 |
.big-title {
|
| 152 |
-
font-size:
|
| 153 |
font-weight: bold;
|
| 154 |
margin-bottom: 18px;
|
| 155 |
color: #343434;
|
| 156 |
letter-spacing: 1px;
|
| 157 |
text-align: center;
|
| 158 |
}
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
font-weight: bold;
|
| 163 |
-
border: none !important;
|
| 164 |
-
border-radius:
|
| 165 |
-
padding:
|
| 166 |
-
margin-left: 10px !important;
|
| 167 |
-
box-shadow: none !important;
|
| 168 |
-
min-width: unset !important;
|
| 169 |
width: auto !important;
|
| 170 |
}
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
| 174 |
font-weight: bold;
|
| 175 |
-
border:
|
| 176 |
-
border-radius:
|
| 177 |
-
padding:
|
| 178 |
-
margin-right: 10px !important;
|
| 179 |
-
box-shadow: none !important;
|
| 180 |
-
min-width: unset !important;
|
| 181 |
width: auto !important;
|
| 182 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
.button-row {
|
| 184 |
margin-top: 8px;
|
| 185 |
}
|
| 186 |
|
| 187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
.image-label-container {
|
| 189 |
-
width: 300px;
|
| 190 |
-
margin:
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
position: relative;
|
| 193 |
-
text-align: center;
|
| 194 |
padding: 0 !important;
|
| 195 |
border: none !important;
|
| 196 |
}
|
| 197 |
|
| 198 |
-
/* >>>>>> 关键:消除图片和下方label的所有间隔 <<<<<< */
|
| 199 |
.image-label-container .gr-image,
|
| 200 |
-
.image-label-container .gr-image-preview
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
display:
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
}
|
| 210 |
|
| 211 |
-
.image-label-container .gr-image .gr-image-img,
|
| 212 |
-
.image-label-container .gr-image-preview .gr-image-img,
|
| 213 |
.image-label-container img {
|
| 214 |
-
margin: 0 !important;
|
| 215 |
-
padding: 0 !important;
|
| 216 |
display: block !important;
|
| 217 |
vertical-align: bottom !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
}
|
| 219 |
|
| 220 |
.image-label-container .img-label-bar {
|
| 221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
text-align: center !important;
|
| 223 |
-
|
| 224 |
-
background: rgb(76, 180, 184);
|
| 225 |
color: #fff;
|
| 226 |
-
padding: 6px 0;
|
| 227 |
border-bottom-left-radius: 10px;
|
| 228 |
border-bottom-right-radius: 10px;
|
| 229 |
-
font-size: 14px;
|
| 230 |
font-weight: normal;
|
|
|
|
|
|
|
| 231 |
}
|
| 232 |
|
| 233 |
-
|
| 234 |
-
.
|
| 235 |
-
.
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
}
|
| 247 |
"""
|
| 248 |
|
|
@@ -365,14 +434,17 @@ with gr.Blocks(title="消化道疾病智能分析系统") as demo:
|
|
| 365 |
)
|
| 366 |
gr.HTML("<div class='img-label-bar'>输入图片</div>")
|
| 367 |
with gr.Row(elem_classes="button-row"):
|
| 368 |
-
|
| 369 |
-
|
|
|
|
| 370 |
|
| 371 |
diag_select.change(fn=show_diag_input, inputs=diag_select, outputs=diag_input_img)
|
| 372 |
|
| 373 |
-
# ---------- 中列:结果表格 ----------
|
| 374 |
with gr.Column():
|
| 375 |
-
diag_table = gr.Dataframe(
|
|
|
|
|
|
|
| 376 |
|
| 377 |
# ---------- 右列:诊断结果 & 建议 ----------
|
| 378 |
with gr.Column():
|
|
|
|
| 132 |
margin-top: 18px;
|
| 133 |
letter-spacing: 2px;
|
| 134 |
}
|
| 135 |
+
|
| 136 |
.blue-dash-border {
|
| 137 |
border: 2.5px dashed #164fa0 !important;
|
| 138 |
border-radius: 22px !important;
|
| 139 |
padding: 0 !important;
|
| 140 |
+
margin-bottom: 16px !important;
|
| 141 |
box-sizing: border-box;
|
| 142 |
}
|
| 143 |
+
|
| 144 |
.big-group {
|
| 145 |
+
background: #fff !important;
|
| 146 |
border: 2px solid #e0e2e5 !important;
|
| 147 |
border-radius: 18px !important;
|
| 148 |
padding: 28px 18px 24px 18px !important;
|
| 149 |
margin: 16px !important;
|
| 150 |
box-shadow: 0 3px 12px 2px rgba(60,64,67,.14);
|
| 151 |
}
|
| 152 |
+
|
| 153 |
.big-title {
|
| 154 |
+
font-size: 28px;
|
| 155 |
font-weight: bold;
|
| 156 |
margin-bottom: 18px;
|
| 157 |
color: #343434;
|
| 158 |
letter-spacing: 1px;
|
| 159 |
text-align: center;
|
| 160 |
}
|
| 161 |
+
|
| 162 |
+
/* ===== 按钮公共属性合并 ===== */
|
| 163 |
+
.orange-btn,
|
| 164 |
+
.orange-btn-diag {
|
| 165 |
+
background: #A7C0DE !important;
|
| 166 |
+
color: #111 !important;
|
| 167 |
+
font-size: 32px;
|
| 168 |
font-weight: bold;
|
| 169 |
+
border: none #5900c2 !important;
|
| 170 |
+
border-radius: 16px !important;
|
| 171 |
+
padding: 12px 20px !important;
|
|
|
|
|
|
|
|
|
|
| 172 |
width: auto !important;
|
| 173 |
}
|
| 174 |
+
|
| 175 |
+
.gray-btn,
|
| 176 |
+
.gray-btn-diag {
|
| 177 |
+
background: #f2f2f2 !important;
|
| 178 |
+
color: #111 !important;
|
| 179 |
+
font-size: 32px;
|
| 180 |
font-weight: bold;
|
| 181 |
+
border: 3px dashed #6c91c2 !important;
|
| 182 |
+
border-radius: 16px !important;
|
| 183 |
+
padding: 12px 20px !important;
|
|
|
|
|
|
|
|
|
|
| 184 |
width: auto !important;
|
| 185 |
}
|
| 186 |
+
|
| 187 |
+
/* ===== 不同之处仅在于左右 margin ===== */
|
| 188 |
+
.orange-btn {
|
| 189 |
+
margin-left: 48px !important;
|
| 190 |
+
margin-right: 48px !important;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
.gray-btn {
|
| 194 |
+
margin-left: 48px !important;
|
| 195 |
+
margin-right: 48px !important;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
/* ====== 诊断模块按钮独立CSS ====== */
|
| 199 |
+
.orange-btn-diag {
|
| 200 |
+
margin-left: 24px !important;
|
| 201 |
+
margin-right: 24px !important;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
.gray-btn-diag {
|
| 205 |
+
margin-left: 24px !important;
|
| 206 |
+
margin-right: 24px !important;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
.button-row {
|
| 210 |
margin-top: 8px;
|
| 211 |
}
|
| 212 |
|
| 213 |
+
.image-label-container,
|
| 214 |
+
.image-label-container * {
|
| 215 |
+
margin: 0 !important;
|
| 216 |
+
padding: 0 !important;
|
| 217 |
+
line-height: 0 !important;
|
| 218 |
+
font-size: 0 !important;
|
| 219 |
+
border-spacing: 0 !important;
|
| 220 |
+
box-sizing: border-box !important;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
.image-label-container {
|
| 224 |
+
width: 300px !important;
|
| 225 |
+
margin-left: auto !important;
|
| 226 |
+
margin-right: auto !important;
|
| 227 |
+
display: flex !important;
|
| 228 |
+
flex-direction: column !important;
|
| 229 |
+
align-items: center !important;
|
| 230 |
+
justify-content: center !important;
|
| 231 |
position: relative;
|
| 232 |
+
text-align: center !important;
|
| 233 |
padding: 0 !important;
|
| 234 |
border: none !important;
|
| 235 |
}
|
| 236 |
|
|
|
|
| 237 |
.image-label-container .gr-image,
|
| 238 |
+
.image-label-container .gr-image-preview {
|
| 239 |
+
width: 300px !important;
|
| 240 |
+
height: 300px !important;
|
| 241 |
+
min-width: 300px !important;
|
| 242 |
+
min-height: 300px !important;
|
| 243 |
+
max-width: 300px !important;
|
| 244 |
+
max-height: 300px !important;
|
| 245 |
+
display: flex !important;
|
| 246 |
+
align-items: center !important;
|
| 247 |
+
justify-content: center !important;
|
| 248 |
+
background: #fff !important;
|
| 249 |
+
border-radius: 10px 10px 0 0 !important;
|
| 250 |
+
box-shadow: 0 2px 12px 0 rgba(60,64,67,.08);
|
| 251 |
}
|
| 252 |
|
|
|
|
|
|
|
| 253 |
.image-label-container img {
|
|
|
|
|
|
|
| 254 |
display: block !important;
|
| 255 |
vertical-align: bottom !important;
|
| 256 |
+
width: 300px !important;
|
| 257 |
+
height: 300px !important;
|
| 258 |
+
margin: 0 auto !important;
|
| 259 |
+
padding: 0 !important;
|
| 260 |
+
border-radius: 10px 10px 0 0 !important;
|
| 261 |
+
background: #fff !important;
|
| 262 |
+
box-shadow: 0 2px 12px 0 rgba(60,64,67,.08);
|
| 263 |
}
|
| 264 |
|
| 265 |
.image-label-container .img-label-bar {
|
| 266 |
+
margin: 0 !important;
|
| 267 |
+
padding-top: 0 !important;
|
| 268 |
+
padding-bottom: 0 !important;
|
| 269 |
+
line-height: normal !important;
|
| 270 |
+
font-size: 22px !important;
|
| 271 |
+
width: 300px !important;
|
| 272 |
text-align: center !important;
|
| 273 |
+
background: rgb(17, 26, 110);
|
|
|
|
| 274 |
color: #fff;
|
|
|
|
| 275 |
border-bottom-left-radius: 10px;
|
| 276 |
border-bottom-right-radius: 10px;
|
|
|
|
| 277 |
font-weight: normal;
|
| 278 |
+
box-sizing: border-box;
|
| 279 |
+
align-self: center !important;
|
| 280 |
}
|
| 281 |
|
| 282 |
+
.gradio-container label,
|
| 283 |
+
.gradio-container .gr-input-label,
|
| 284 |
+
.gradio-container .block-label {
|
| 285 |
+
font-size: 36px !important;
|
| 286 |
+
font-weight: 500 !important;
|
| 287 |
+
color: #222 !important;
|
| 288 |
+
letter-spacing: 0.5px;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
.gradio-container select,
|
| 292 |
+
.gradio-container option,
|
| 293 |
+
.gradio-container input[type="text"] {
|
| 294 |
+
font-size: 22px !important;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
.gradio-container .gr-dataframe,
|
| 298 |
+
.gradio-container .gr-dataframe table,
|
| 299 |
+
.gradio-container .gr-dataframe table th,
|
| 300 |
+
.gradio-container .gr-dataframe table td {
|
| 301 |
+
font-size: 28px !important;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
.gradio-container .gr-dataframe .block-label,
|
| 305 |
+
.gradio-container .gr-dataframe label {
|
| 306 |
+
font-size: 28px !important;
|
| 307 |
+
font-weight: 600 !important;
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
.gradio-container .gr-textbox,
|
| 311 |
+
.gradio-container .gr-textbox textarea,
|
| 312 |
+
.gradio-container .gr-textbox .block-label,
|
| 313 |
+
.gradio-container .gr-textbox label {
|
| 314 |
+
font-size: 28px !important;
|
| 315 |
}
|
| 316 |
"""
|
| 317 |
|
|
|
|
| 434 |
)
|
| 435 |
gr.HTML("<div class='img-label-bar'>输入图片</div>")
|
| 436 |
with gr.Row(elem_classes="button-row"):
|
| 437 |
+
# === 这里用新class名 ===
|
| 438 |
+
diag_reset_btn = gr.Button("清空", elem_classes="gray-btn-diag")
|
| 439 |
+
diag_btn = gr.Button("点击执行诊断", elem_classes="orange-btn-diag")
|
| 440 |
|
| 441 |
diag_select.change(fn=show_diag_input, inputs=diag_select, outputs=diag_input_img)
|
| 442 |
|
| 443 |
+
# ---------- 中列:结果表格(新增label) ----------
|
| 444 |
with gr.Column():
|
| 445 |
+
diag_table = gr.Dataframe(
|
| 446 |
+
headers=["诊断类别", "模型预测概率"]
|
| 447 |
+
)
|
| 448 |
|
| 449 |
# ---------- 右列:诊断结果 & 建议 ----------
|
| 450 |
with gr.Column():
|