Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -153,42 +153,96 @@ SAVE_LOCK = threading.Lock()
|
|
| 153 |
|
| 154 |
CUSTOM_CSS = """
|
| 155 |
.gradio-container {
|
| 156 |
-
max-width:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
}
|
| 158 |
#hero {
|
| 159 |
-
border: 1px solid #
|
| 160 |
-
border-radius:
|
| 161 |
-
padding:
|
| 162 |
-
background:
|
| 163 |
-
|
| 164 |
-
|
|
|
|
| 165 |
}
|
| 166 |
#hero h1 {
|
| 167 |
-
margin: 0 0
|
| 168 |
font-size: 2rem;
|
| 169 |
-
|
| 170 |
}
|
| 171 |
#hero p {
|
| 172 |
margin: 0;
|
| 173 |
-
color: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
}
|
| 175 |
.panel {
|
| 176 |
-
border: 1px solid #
|
| 177 |
-
border-radius:
|
| 178 |
padding: 14px !important;
|
| 179 |
-
background: linear-gradient(180deg,
|
|
|
|
| 180 |
}
|
| 181 |
.hint {
|
| 182 |
-
color: #
|
| 183 |
font-size: 0.9rem;
|
| 184 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
.metric-card {
|
| 186 |
-
border: 1px solid #
|
| 187 |
-
border-radius: 12px
|
| 188 |
-
|
|
|
|
|
|
|
| 189 |
}
|
| 190 |
-
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
| 192 |
}
|
| 193 |
"""
|
| 194 |
|
|
@@ -384,7 +438,12 @@ def create_app():
|
|
| 384 |
"""
|
| 385 |
<div id="hero">
|
| 386 |
<h1>VideoEval · Movie-Level Evaluation</h1>
|
| 387 |
-
<p>统一电影级评测问卷,支持方法级均分统计(含 CL / CRh / AVG)</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
</div>
|
| 389 |
"""
|
| 390 |
)
|
|
@@ -399,7 +458,6 @@ def create_app():
|
|
| 399 |
with gr.Row():
|
| 400 |
with gr.Column(scale=5, elem_classes=["panel"]):
|
| 401 |
gr.Markdown("### 1) 评测员与样本")
|
| 402 |
-
gr.Markdown("<span class='hint'>先确认评测员身份与匿名样本,再开始打分。</span>")
|
| 403 |
with gr.Row():
|
| 404 |
evaluator_input = gr.Textbox(label="Evaluator ID", value="anonymous")
|
| 405 |
sample_dropdown = gr.Dropdown(
|
|
@@ -408,7 +466,7 @@ def create_app():
|
|
| 408 |
value=samples[0]["anon_id"] if samples else None,
|
| 409 |
interactive=True,
|
| 410 |
)
|
| 411 |
-
with gr.Row(
|
| 412 |
prev_btn = gr.Button("← Previous")
|
| 413 |
next_btn = gr.Button("Next →")
|
| 414 |
submit_btn = gr.Button("提交当前评分并统计", variant="primary")
|
|
@@ -437,14 +495,16 @@ def create_app():
|
|
| 437 |
with gr.Accordion(section_title, open=True):
|
| 438 |
for key in keys:
|
| 439 |
name, desc = criteria_map[key]
|
| 440 |
-
with gr.Group(elem_classes=["
|
| 441 |
-
gr.Markdown(
|
| 442 |
-
|
|
|
|
| 443 |
with gr.Row():
|
| 444 |
score_widgets[key] = gr.Radio(choices=[1, 2, 3, 4, 5], label=f"{key} Score", scale=1)
|
| 445 |
reason_widgets[key] = gr.Textbox(label=f"{key} Reason(可选)", lines=2, placeholder="补充评分依据", scale=2)
|
| 446 |
|
| 447 |
final_summary = gr.Textbox(label="Final Summary(可选)", lines=4, placeholder="总结该视频的主要优缺点")
|
|
|
|
| 448 |
|
| 449 |
def _sync_sample_from_dropdown(anon_id: str) -> Tuple[str, str, int]:
|
| 450 |
if not anon_id or anon_id not in sample_map:
|
|
|
|
| 153 |
|
| 154 |
CUSTOM_CSS = """
|
| 155 |
.gradio-container {
|
| 156 |
+
max-width: 1360px !important;
|
| 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 #334155;
|
| 171 |
+
border-radius: 20px;
|
| 172 |
+
padding: 24px 28px;
|
| 173 |
+
background:
|
| 174 |
+
linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(37, 51, 89, 0.95) 45%, rgba(59, 39, 97, 0.92) 100%);
|
| 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: 2rem;
|
| 181 |
+
font-weight: 700;
|
| 182 |
}
|
| 183 |
#hero p {
|
| 184 |
margin: 0;
|
| 185 |
+
color: #dbe6ff;
|
| 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 #334155 !important;
|
| 204 |
+
border-radius: 16px !important;
|
| 205 |
padding: 14px !important;
|
| 206 |
+
background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.75) 100%) !important;
|
| 207 |
+
box-shadow: 0 10px 30px rgba(2, 6, 23, 0.28);
|
| 208 |
}
|
| 209 |
.hint {
|
| 210 |
+
color: #a5b4d8;
|
| 211 |
font-size: 0.9rem;
|
| 212 |
}
|
| 213 |
+
.gr-button {
|
| 214 |
+
border-radius: 10px !important;
|
| 215 |
+
border: 1px solid #3a475f !important;
|
| 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 |
.metric-card {
|
| 235 |
+
border: 1px solid #2f3a52;
|
| 236 |
+
border-radius: 12px;
|
| 237 |
+
padding: 10px 12px;
|
| 238 |
+
margin-bottom: 8px;
|
| 239 |
+
background: rgba(15, 23, 42, 0.48);
|
| 240 |
}
|
| 241 |
+
.footer-note {
|
| 242 |
+
margin-top: 14px;
|
| 243 |
+
color: #93a4c4;
|
| 244 |
+
font-size: 0.82rem;
|
| 245 |
+
text-align: right;
|
| 246 |
}
|
| 247 |
"""
|
| 248 |
|
|
|
|
| 438 |
"""
|
| 439 |
<div id="hero">
|
| 440 |
<h1>VideoEval · Movie-Level Evaluation</h1>
|
| 441 |
+
<p>统一电影级评测问卷,支持方法级均分统计(含 CL / CRh / AVG)。界面已针对 Hugging Face Spaces 展示体验进行优化,适合评测、演示与数据回收。</p>
|
| 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 |
)
|
|
|
|
| 458 |
with gr.Row():
|
| 459 |
with gr.Column(scale=5, elem_classes=["panel"]):
|
| 460 |
gr.Markdown("### 1) 评测员与样本")
|
|
|
|
| 461 |
with gr.Row():
|
| 462 |
evaluator_input = gr.Textbox(label="Evaluator ID", value="anonymous")
|
| 463 |
sample_dropdown = gr.Dropdown(
|
|
|
|
| 466 |
value=samples[0]["anon_id"] if samples else None,
|
| 467 |
interactive=True,
|
| 468 |
)
|
| 469 |
+
with gr.Row():
|
| 470 |
prev_btn = gr.Button("← Previous")
|
| 471 |
next_btn = gr.Button("Next →")
|
| 472 |
submit_btn = gr.Button("提交当前评分并统计", variant="primary")
|
|
|
|
| 495 |
with gr.Accordion(section_title, open=True):
|
| 496 |
for key in keys:
|
| 497 |
name, desc = criteria_map[key]
|
| 498 |
+
with gr.Group(elem_classes=["panel"]):
|
| 499 |
+
gr.Markdown(
|
| 500 |
+
f"<div class='metric-card'><strong>{key} · {name}</strong><br/><span class='hint'>{desc}</span></div>"
|
| 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:
|