Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -153,96 +153,57 @@ SAVE_LOCK = threading.Lock()
|
|
| 153 |
|
| 154 |
CUSTOM_CSS = """
|
| 155 |
.gradio-container {
|
| 156 |
-
max-width:
|
| 157 |
-
background:
|
| 158 |
-
radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.20) 0%, transparent 36%),
|
| 159 |
-
radial-gradient(circle at 82% 14%, rgba(59, 130, 246, 0.18) 0%, transparent 40%),
|
| 160 |
-
linear-gradient(180deg, #070b16 0%, #0f1424 42%, #111827 100%);
|
| 161 |
-
min-height: 100vh;
|
| 162 |
-
}
|
| 163 |
-
.gradio-container h1,
|
| 164 |
-
.gradio-container h2,
|
| 165 |
-
.gradio-container h3,
|
| 166 |
-
.gradio-container h4 {
|
| 167 |
-
letter-spacing: 0.2px;
|
| 168 |
}
|
| 169 |
#hero {
|
| 170 |
-
border: 1px solid #
|
| 171 |
-
border-radius:
|
| 172 |
-
padding:
|
| 173 |
-
background:
|
| 174 |
-
|
| 175 |
-
margin-bottom: 16px;
|
| 176 |
-
box-shadow: 0 14px 38px rgba(2, 6, 23, 0.42);
|
| 177 |
}
|
| 178 |
#hero h1 {
|
| 179 |
margin: 0 0 8px 0;
|
| 180 |
-
font-size:
|
| 181 |
-
font-weight: 700;
|
| 182 |
}
|
| 183 |
#hero p {
|
| 184 |
margin: 0;
|
| 185 |
-
color: #
|
| 186 |
-
line-height: 1.55;
|
| 187 |
-
}
|
| 188 |
-
.stats-strip {
|
| 189 |
-
display: flex;
|
| 190 |
-
flex-wrap: wrap;
|
| 191 |
-
gap: 10px;
|
| 192 |
-
margin-top: 14px;
|
| 193 |
-
}
|
| 194 |
-
.stat-chip {
|
| 195 |
-
border: 1px solid #475569;
|
| 196 |
-
border-radius: 999px;
|
| 197 |
-
padding: 6px 12px;
|
| 198 |
-
font-size: 0.85rem;
|
| 199 |
-
color: #dbeafe;
|
| 200 |
-
background: rgba(15, 23, 42, 0.45);
|
| 201 |
}
|
| 202 |
.panel {
|
| 203 |
-
border: 1px solid #
|
| 204 |
-
border-radius:
|
| 205 |
padding: 14px !important;
|
| 206 |
-
background:
|
| 207 |
-
box-shadow: 0 10px 30px rgba(2, 6, 23, 0.28);
|
| 208 |
}
|
| 209 |
.hint {
|
| 210 |
-
color: #
|
| 211 |
font-size: 0.9rem;
|
| 212 |
}
|
| 213 |
-
.
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
.gr-button.primary {
|
| 218 |
-
background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 45%, #3b82f6 100%) !important;
|
| 219 |
-
color: white !important;
|
| 220 |
-
border: none !important;
|
| 221 |
-
}
|
| 222 |
-
.gr-button:hover {
|
| 223 |
-
transform: translateY(-1px);
|
| 224 |
-
transition: all 0.15s ease;
|
| 225 |
-
}
|
| 226 |
-
.gr-accordion {
|
| 227 |
-
border: 1px solid #2f3a52 !important;
|
| 228 |
-
border-radius: 14px !important;
|
| 229 |
-
background: rgba(15, 23, 42, 0.64) !important;
|
| 230 |
-
}
|
| 231 |
-
.gr-accordion .label-wrap span {
|
| 232 |
-
font-weight: 600 !important;
|
| 233 |
}
|
| 234 |
-
.
|
| 235 |
-
border: 1px solid
|
| 236 |
border-radius: 12px;
|
|
|
|
| 237 |
padding: 10px 12px;
|
| 238 |
-
margin-bottom: 8px;
|
| 239 |
-
background: rgba(15, 23, 42, 0.48);
|
| 240 |
}
|
| 241 |
-
.
|
| 242 |
-
margin
|
| 243 |
-
|
| 244 |
-
font-
|
| 245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
}
|
| 247 |
"""
|
| 248 |
|
|
@@ -419,9 +380,20 @@ def recompute_method_aggregates() -> Path:
|
|
| 419 |
def build_sample_brief(sample: Dict[str, Any], index: int, total: int) -> str:
|
| 420 |
story = sample.get("story_text") or "(未找到对应 story 文本,请检查 clip_movie_story 下是否有同名 txt)"
|
| 421 |
return (
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
)
|
| 426 |
|
| 427 |
|
|
@@ -438,12 +410,7 @@ def create_app():
|
|
| 438 |
"""
|
| 439 |
<div id="hero">
|
| 440 |
<h1>VideoEval · Movie-Level Evaluation</h1>
|
| 441 |
-
<p>统一电影级评测问卷,支持方法级均分统计(含 CL / CRh / AVG)
|
| 442 |
-
<div class="stats-strip">
|
| 443 |
-
<span class="stat-chip">Movie-Level · 12 Metrics</span>
|
| 444 |
-
<span class="stat-chip">Auto Aggregate · CL / CRh / AVG</span>
|
| 445 |
-
<span class="stat-chip">Space Ready · Persistent Storage</span>
|
| 446 |
-
</div>
|
| 447 |
</div>
|
| 448 |
"""
|
| 449 |
)
|
|
@@ -496,15 +463,13 @@ def create_app():
|
|
| 496 |
for key in keys:
|
| 497 |
name, desc = criteria_map[key]
|
| 498 |
with gr.Group(elem_classes=["panel"]):
|
| 499 |
-
gr.Markdown(
|
| 500 |
-
|
| 501 |
-
)
|
| 502 |
with gr.Row():
|
| 503 |
score_widgets[key] = gr.Radio(choices=[1, 2, 3, 4, 5], label=f"{key} Score", scale=1)
|
| 504 |
reason_widgets[key] = gr.Textbox(label=f"{key} Reason(可选)", lines=2, placeholder="补充评分依据", scale=2)
|
| 505 |
|
| 506 |
final_summary = gr.Textbox(label="Final Summary(可选)", lines=4, placeholder="总结该视频的主要优缺点")
|
| 507 |
-
gr.HTML("<div class='footer-note'>VideoEval Space UI · Crafted for clearer human evaluation workflow</div>")
|
| 508 |
|
| 509 |
def _sync_sample_from_dropdown(anon_id: str) -> Tuple[str, str, int]:
|
| 510 |
if not anon_id or anon_id not in sample_map:
|
|
|
|
| 153 |
|
| 154 |
CUSTOM_CSS = """
|
| 155 |
.gradio-container {
|
| 156 |
+
max-width: 1300px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
}
|
| 158 |
#hero {
|
| 159 |
+
border: 1px solid #2b2f3a;
|
| 160 |
+
border-radius: 16px;
|
| 161 |
+
padding: 20px 22px;
|
| 162 |
+
background: linear-gradient(135deg, #121826 0%, #1d2540 55%, #2a1f45 100%);
|
| 163 |
+
margin-bottom: 14px;
|
|
|
|
|
|
|
| 164 |
}
|
| 165 |
#hero h1 {
|
| 166 |
margin: 0 0 8px 0;
|
| 167 |
+
font-size: 1.9rem;
|
|
|
|
| 168 |
}
|
| 169 |
#hero p {
|
| 170 |
margin: 0;
|
| 171 |
+
color: #d0d8f0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
}
|
| 173 |
.panel {
|
| 174 |
+
border: 1px solid #2e3445 !important;
|
| 175 |
+
border-radius: 14px !important;
|
| 176 |
padding: 14px !important;
|
| 177 |
+
background: #111522 !important;
|
|
|
|
| 178 |
}
|
| 179 |
.hint {
|
| 180 |
+
color: #9aa7c9;
|
| 181 |
font-size: 0.9rem;
|
| 182 |
}
|
| 183 |
+
.sample-brief {
|
| 184 |
+
display: grid;
|
| 185 |
+
gap: 10px;
|
| 186 |
+
margin-top: 8px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
}
|
| 188 |
+
.sample-brief-card {
|
| 189 |
+
border: 1px solid rgba(150, 168, 210, 0.35);
|
| 190 |
border-radius: 12px;
|
| 191 |
+
background: rgba(110, 130, 180, 0.12);
|
| 192 |
padding: 10px 12px;
|
|
|
|
|
|
|
| 193 |
}
|
| 194 |
+
.sample-brief-title {
|
| 195 |
+
margin: 0 0 6px 0;
|
| 196 |
+
font-size: 0.88rem;
|
| 197 |
+
font-weight: 600;
|
| 198 |
+
color: #c3d0f1;
|
| 199 |
+
letter-spacing: 0.02em;
|
| 200 |
+
text-transform: uppercase;
|
| 201 |
+
}
|
| 202 |
+
.sample-brief-text {
|
| 203 |
+
margin: 0;
|
| 204 |
+
color: #e5ebff;
|
| 205 |
+
line-height: 1.55;
|
| 206 |
+
white-space: pre-wrap;
|
| 207 |
}
|
| 208 |
"""
|
| 209 |
|
|
|
|
| 380 |
def build_sample_brief(sample: Dict[str, Any], index: int, total: int) -> str:
|
| 381 |
story = sample.get("story_text") or "(未找到对应 story 文本,请检查 clip_movie_story 下是否有同名 txt)"
|
| 382 |
return (
|
| 383 |
+
"<div class='sample-brief'>"
|
| 384 |
+
"<div class='sample-brief-card'>"
|
| 385 |
+
"<p class='sample-brief-title'>当前匿名样本</p>"
|
| 386 |
+
f"<p class='sample-brief-text'>{index + 1}/{total}</p>"
|
| 387 |
+
"</div>"
|
| 388 |
+
"<div class='sample-brief-card'>"
|
| 389 |
+
"<p class='sample-brief-title'>Sample ID</p>"
|
| 390 |
+
f"<p class='sample-brief-text'><code>{sample['anon_id']}</code></p>"
|
| 391 |
+
"</div>"
|
| 392 |
+
"<div class='sample-brief-card'>"
|
| 393 |
+
"<p class='sample-brief-title'>Story Description</p>"
|
| 394 |
+
f"<p class='sample-brief-text'>{story}</p>"
|
| 395 |
+
"</div>"
|
| 396 |
+
"</div>"
|
| 397 |
)
|
| 398 |
|
| 399 |
|
|
|
|
| 410 |
"""
|
| 411 |
<div id="hero">
|
| 412 |
<h1>VideoEval · Movie-Level Evaluation</h1>
|
| 413 |
+
<p>统一电影级评测问卷,支持方法级均分统计(含 CL / CRh / AVG)</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
</div>
|
| 415 |
"""
|
| 416 |
)
|
|
|
|
| 463 |
for key in keys:
|
| 464 |
name, desc = criteria_map[key]
|
| 465 |
with gr.Group(elem_classes=["panel"]):
|
| 466 |
+
gr.Markdown(f"**{key} · {name}**")
|
| 467 |
+
gr.Markdown(f"<span class='hint'>{desc}</span>")
|
|
|
|
| 468 |
with gr.Row():
|
| 469 |
score_widgets[key] = gr.Radio(choices=[1, 2, 3, 4, 5], label=f"{key} Score", scale=1)
|
| 470 |
reason_widgets[key] = gr.Textbox(label=f"{key} Reason(可选)", lines=2, placeholder="补充评分依据", scale=2)
|
| 471 |
|
| 472 |
final_summary = gr.Textbox(label="Final Summary(可选)", lines=4, placeholder="总结该视频的主要优缺点")
|
|
|
|
| 473 |
|
| 474 |
def _sync_sample_from_dropdown(anon_id: str) -> Tuple[str, str, int]:
|
| 475 |
if not anon_id or anon_id not in sample_map:
|