Spaces:
Sleeping
Sleeping
Wenjiawang0312
commited on
Commit
·
bf0ad17
1
Parent(s):
9eee075
store
Browse files
app.py
CHANGED
|
@@ -157,27 +157,30 @@ def create_video_survey_app():
|
|
| 157 |
print(f"找到 {len(question_folders)} 个场景")
|
| 158 |
|
| 159 |
with gr.Blocks(title="视频生成质量用户研究", theme=gr.themes.Soft()) as demo:
|
| 160 |
-
|
| 161 |
-
gr.
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
# 为每个场景创建界面
|
| 176 |
-
for scene_idx, scene_name in enumerate(question_folders):
|
| 177 |
-
videos, method_mapping = get_videos_for_question(scene_name)
|
| 178 |
|
| 179 |
-
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
# 4个视频横向排列
|
| 183 |
with gr.Row(equal_height=True, variant="compact"):
|
|
@@ -207,36 +210,18 @@ def create_video_survey_app():
|
|
| 207 |
)
|
| 208 |
|
| 209 |
# 三个评分滑块(垂直排列)
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
overall = gr.Slider(
|
| 223 |
-
minimum=1, maximum=5, step=1, value=3,
|
| 224 |
-
label="整体质量 / Overall",
|
| 225 |
-
info="1=差, 5=优秀"
|
| 226 |
-
)
|
| 227 |
-
else:
|
| 228 |
-
dynamic = gr.Slider(
|
| 229 |
-
minimum=1, maximum=5, step=1, value=3,
|
| 230 |
-
label="动态 / Dynamic"
|
| 231 |
-
)
|
| 232 |
-
static = gr.Slider(
|
| 233 |
-
minimum=1, maximum=5, step=1, value=3,
|
| 234 |
-
label="静态 / Static"
|
| 235 |
-
)
|
| 236 |
-
overall = gr.Slider(
|
| 237 |
-
minimum=1, maximum=5, step=1, value=3,
|
| 238 |
-
label="整体 / Overall"
|
| 239 |
-
)
|
| 240 |
|
| 241 |
scene_ratings.append({
|
| 242 |
"method": method_name,
|
|
@@ -245,19 +230,18 @@ def create_video_survey_app():
|
|
| 245 |
"overall": overall
|
| 246 |
})
|
| 247 |
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
with gr.Column(visible=True) as survey_content:
|
| 258 |
submit_btn = gr.Button("📤 提交所有评分 / Submit All Ratings", variant="primary", size="lg")
|
| 259 |
|
| 260 |
-
|
|
|
|
| 261 |
gr.Markdown("""
|
| 262 |
# ✅ 提交成功!/ Submission Successful!
|
| 263 |
|
|
@@ -298,7 +282,7 @@ def create_video_survey_app():
|
|
| 298 |
# 保存评分
|
| 299 |
save_ratings(scene_name, ratings, method_mapping)
|
| 300 |
|
| 301 |
-
#
|
| 302 |
return gr.Column(visible=False), gr.Column(visible=True), ""
|
| 303 |
except Exception as e:
|
| 304 |
return gr.Column(visible=True), gr.Column(visible=False), f"❌ **保存失败** / Save failed: {str(e)}"
|
|
@@ -317,7 +301,7 @@ def create_video_survey_app():
|
|
| 317 |
submit_btn.click(
|
| 318 |
submit_all_ratings,
|
| 319 |
inputs=all_rating_inputs,
|
| 320 |
-
outputs=[
|
| 321 |
)
|
| 322 |
|
| 323 |
return demo
|
|
|
|
| 157 |
print(f"找到 {len(question_folders)} 个场景")
|
| 158 |
|
| 159 |
with gr.Blocks(title="视频生成质量用户研究", theme=gr.themes.Soft()) as demo:
|
| 160 |
+
# 问卷内容区域
|
| 161 |
+
with gr.Column(visible=True) as survey_area:
|
| 162 |
+
gr.Markdown("# 🎬 视频生成质量用户研究 / Video Generation Quality User Study")
|
| 163 |
+
gr.Markdown("""
|
| 164 |
+
### 说明 / Instructions:
|
| 165 |
+
- 请观看每个视频并进行评分 / Please watch each video and rate them
|
| 166 |
+
- **💡 提示:可以点击视频右下角全屏按钮观看清晰细节** / Tip: Click fullscreen button to view details
|
| 167 |
+
- 评分标准 / Rating criteria:
|
| 168 |
+
- **动态生成质量** / Dynamic Generation Quality: 视频中物体运动的流畅性和真实性
|
| 169 |
+
- **静态一致性** / Static Consistency: 视频中静态物体的稳定性和一致性
|
| 170 |
+
- **整体质量** / Overall Quality: 视频的整体观感
|
| 171 |
+
- 评分范围:1-5分(5分最好)/ Rating scale: 1-5 (5 = Best)
|
| 172 |
+
- 完成所有评分后,点击底部的"提交所有评分"按钮 / After rating all videos, click "Submit All Ratings" at the bottom
|
| 173 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
+
# 存储所有评分组件
|
| 176 |
+
all_scene_components = []
|
| 177 |
+
|
| 178 |
+
# 为每个场景创建界面
|
| 179 |
+
for scene_idx, scene_name in enumerate(question_folders):
|
| 180 |
+
videos, method_mapping = get_videos_for_question(scene_name)
|
| 181 |
+
|
| 182 |
+
with gr.Group():
|
| 183 |
+
gr.Markdown(f"## 场景 {scene_idx + 1} / Scene {scene_idx + 1}: `{scene_name}`")
|
| 184 |
|
| 185 |
# 4个视频横向排列
|
| 186 |
with gr.Row(equal_height=True, variant="compact"):
|
|
|
|
| 210 |
)
|
| 211 |
|
| 212 |
# 三个评分滑块(垂直排列)
|
| 213 |
+
dynamic = gr.Slider(
|
| 214 |
+
minimum=1, maximum=5, step=1, value=3,
|
| 215 |
+
label="动态质量 / Dynamic"
|
| 216 |
+
)
|
| 217 |
+
static = gr.Slider(
|
| 218 |
+
minimum=1, maximum=5, step=1, value=3,
|
| 219 |
+
label="静态一致性 / Static"
|
| 220 |
+
)
|
| 221 |
+
overall = gr.Slider(
|
| 222 |
+
minimum=1, maximum=5, step=1, value=3,
|
| 223 |
+
label="整体质量 / Overall"
|
| 224 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
scene_ratings.append({
|
| 227 |
"method": method_name,
|
|
|
|
| 230 |
"overall": overall
|
| 231 |
})
|
| 232 |
|
| 233 |
+
all_scene_components.append({
|
| 234 |
+
"scene_name": scene_name,
|
| 235 |
+
"method_mapping": method_mapping,
|
| 236 |
+
"ratings": scene_ratings
|
| 237 |
+
})
|
| 238 |
+
|
| 239 |
+
# 提交按钮
|
| 240 |
+
gr.Markdown("---")
|
|
|
|
|
|
|
| 241 |
submit_btn = gr.Button("📤 提交所有评分 / Submit All Ratings", variant="primary", size="lg")
|
| 242 |
|
| 243 |
+
# 感谢页面(初始隐藏)
|
| 244 |
+
with gr.Column(visible=False) as thank_you_page:
|
| 245 |
gr.Markdown("""
|
| 246 |
# ✅ 提交成功!/ Submission Successful!
|
| 247 |
|
|
|
|
| 282 |
# 保存评分
|
| 283 |
save_ratings(scene_name, ratings, method_mapping)
|
| 284 |
|
| 285 |
+
# 隐藏问卷,显示感谢页面
|
| 286 |
return gr.Column(visible=False), gr.Column(visible=True), ""
|
| 287 |
except Exception as e:
|
| 288 |
return gr.Column(visible=True), gr.Column(visible=False), f"❌ **保存失败** / Save failed: {str(e)}"
|
|
|
|
| 301 |
submit_btn.click(
|
| 302 |
submit_all_ratings,
|
| 303 |
inputs=all_rating_inputs,
|
| 304 |
+
outputs=[survey_area, thank_you_page, status_output]
|
| 305 |
)
|
| 306 |
|
| 307 |
return demo
|