Spaces:
Running
Running
Zenith Wang
commited on
Commit
·
765ca1b
1
Parent(s):
4f9934c
Fix AttributeError by removing gr.Box and using more aggressive CSS selectors
Browse files
app.py
CHANGED
|
@@ -268,59 +268,74 @@ def process_message(message, history, images, system_prompt, temperature, max_to
|
|
| 268 |
|
| 269 |
# 创建Gradio界面
|
| 270 |
css = """
|
| 271 |
-
/*
|
| 272 |
-
.compact-file-
|
| 273 |
height: 52px !important;
|
| 274 |
max-height: 52px !important;
|
| 275 |
-
|
| 276 |
-
border: none !important;
|
| 277 |
-
background: transparent !important;
|
| 278 |
}
|
| 279 |
|
| 280 |
-
/*
|
| 281 |
#image-upload {
|
| 282 |
height: 52px !important;
|
| 283 |
max-height: 52px !important;
|
|
|
|
| 284 |
}
|
| 285 |
|
| 286 |
-
#image-upload > div
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
#image-upload .wrap {
|
| 292 |
height: 52px !important;
|
| 293 |
max-height: 52px !important;
|
|
|
|
| 294 |
padding: 0 !important;
|
|
|
|
| 295 |
}
|
| 296 |
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
#image-upload button {
|
| 304 |
-
height: 48px !important;
|
| 305 |
font-size: 13px !important;
|
| 306 |
-
padding: 0
|
|
|
|
| 307 |
}
|
| 308 |
|
| 309 |
/* 文件预览区域 */
|
| 310 |
-
#image-upload .file-preview
|
| 311 |
-
|
| 312 |
-
|
|
|
|
| 313 |
overflow-y: auto !important;
|
|
|
|
|
|
|
| 314 |
}
|
| 315 |
|
| 316 |
-
/*
|
| 317 |
-
#image-upload label
|
|
|
|
| 318 |
display: none !important;
|
| 319 |
}
|
| 320 |
|
| 321 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
#message-textbox textarea {
|
| 323 |
min-height: 52px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
}
|
| 325 |
"""
|
| 326 |
|
|
@@ -358,16 +373,15 @@ with gr.Blocks(title="Step-3", theme=gr.themes.Soft(), css=css) as demo:
|
|
| 358 |
elem_id="message-textbox"
|
| 359 |
)
|
| 360 |
with gr.Column(scale=2):
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
)
|
| 371 |
with gr.Column(scale=1, min_width=100):
|
| 372 |
submit_btn = gr.Button("Send", variant="primary")
|
| 373 |
|
|
|
|
| 268 |
|
| 269 |
# 创建Gradio界面
|
| 270 |
css = """
|
| 271 |
+
/* 强制设置File组件容器高度 */
|
| 272 |
+
.compact-file, .compact-file > * {
|
| 273 |
height: 52px !important;
|
| 274 |
max-height: 52px !important;
|
| 275 |
+
min-height: 52px !important;
|
|
|
|
|
|
|
| 276 |
}
|
| 277 |
|
| 278 |
+
/* 使用ID选择器确保优先级 */
|
| 279 |
#image-upload {
|
| 280 |
height: 52px !important;
|
| 281 |
max-height: 52px !important;
|
| 282 |
+
min-height: 52px !important;
|
| 283 |
}
|
| 284 |
|
| 285 |
+
#image-upload > div,
|
| 286 |
+
#image-upload .wrap,
|
| 287 |
+
#image-upload .block,
|
| 288 |
+
#image-upload .container {
|
|
|
|
|
|
|
| 289 |
height: 52px !important;
|
| 290 |
max-height: 52px !important;
|
| 291 |
+
min-height: 52px !important;
|
| 292 |
padding: 0 !important;
|
| 293 |
+
margin: 0 !important;
|
| 294 |
}
|
| 295 |
|
| 296 |
+
/* 文件上传按钮样式 */
|
| 297 |
+
#image-upload button,
|
| 298 |
+
.compact-file button {
|
| 299 |
+
height: 50px !important;
|
| 300 |
+
max-height: 50px !important;
|
| 301 |
+
min-height: 50px !important;
|
|
|
|
|
|
|
| 302 |
font-size: 13px !important;
|
| 303 |
+
padding: 0 12px !important;
|
| 304 |
+
margin: 1px !important;
|
| 305 |
}
|
| 306 |
|
| 307 |
/* 文件预览区域 */
|
| 308 |
+
#image-upload .file-preview,
|
| 309 |
+
.compact-file .file-preview {
|
| 310 |
+
height: 50px !important;
|
| 311 |
+
max-height: 50px !important;
|
| 312 |
overflow-y: auto !important;
|
| 313 |
+
font-size: 12px !important;
|
| 314 |
+
padding: 4px !important;
|
| 315 |
}
|
| 316 |
|
| 317 |
+
/* 隐藏标签 */
|
| 318 |
+
#image-upload label,
|
| 319 |
+
.compact-file label {
|
| 320 |
display: none !important;
|
| 321 |
}
|
| 322 |
|
| 323 |
+
/* 确保input元素也是正确高度 */
|
| 324 |
+
#image-upload input[type="file"],
|
| 325 |
+
.compact-file input[type="file"] {
|
| 326 |
+
height: 50px !important;
|
| 327 |
+
max-height: 50px !important;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
/* 文本框参考高度 */
|
| 331 |
#message-textbox textarea {
|
| 332 |
min-height: 52px !important;
|
| 333 |
+
max-height: 52px !important;
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
/* 使用通配符确保所有子元素 */
|
| 337 |
+
#image-upload * {
|
| 338 |
+
max-height: 52px !important;
|
| 339 |
}
|
| 340 |
"""
|
| 341 |
|
|
|
|
| 373 |
elem_id="message-textbox"
|
| 374 |
)
|
| 375 |
with gr.Column(scale=2):
|
| 376 |
+
image_input = gr.File(
|
| 377 |
+
label="Upload Images",
|
| 378 |
+
file_count="multiple",
|
| 379 |
+
file_types=[".png", ".jpg", ".jpeg", ".gif", ".webp"],
|
| 380 |
+
interactive=True,
|
| 381 |
+
show_label=False,
|
| 382 |
+
elem_classes="compact-file",
|
| 383 |
+
elem_id="image-upload"
|
| 384 |
+
)
|
|
|
|
| 385 |
with gr.Column(scale=1, min_width=100):
|
| 386 |
submit_btn = gr.Button("Send", variant="primary")
|
| 387 |
|