Spaces:
Sleeping
Sleeping
JingdongZhang commited on
Commit ·
6f120dc
1
Parent(s): a790bf2
Upload images via Git LFS
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +3 -0
- app.py +322 -0
- requirements.txt +1 -0
- user_study_pairs/haze_203_dehazeformer.jpg +3 -0
- user_study_pairs/haze_203_diffdehaze.jpg +3 -0
- user_study_pairs/haze_203_flux.jpg +3 -0
- user_study_pairs/haze_203_nano_banana.jpg +3 -0
- user_study_pairs/haze_203_ours.jpg +3 -0
- user_study_pairs/haze_203_seedream.jpg +3 -0
- user_study_pairs/haze_205_dehazeformer.jpg +3 -0
- user_study_pairs/haze_205_diffdehaze.jpg +3 -0
- user_study_pairs/haze_205_flux.jpg +3 -0
- user_study_pairs/haze_205_nano_banana.jpg +3 -0
- user_study_pairs/haze_205_ours.jpg +3 -0
- user_study_pairs/haze_205_seedream.jpg +3 -0
- user_study_pairs/haze_224_dehazeformer.jpg +3 -0
- user_study_pairs/haze_224_diffdehaze.jpg +3 -0
- user_study_pairs/haze_224_flux.jpg +3 -0
- user_study_pairs/haze_224_nano_banana.jpg +3 -0
- user_study_pairs/haze_224_ours.jpg +3 -0
- user_study_pairs/haze_224_seedream.jpg +3 -0
- user_study_pairs/haze_225_dehazeformer.jpg +3 -0
- user_study_pairs/haze_225_diffdehaze.jpg +3 -0
- user_study_pairs/haze_225_flux.jpg +3 -0
- user_study_pairs/haze_225_nano_banana.jpg +3 -0
- user_study_pairs/haze_225_ours.jpg +3 -0
- user_study_pairs/haze_225_seedream.jpg +3 -0
- user_study_pairs/haze_235_dehazeformer.jpg +3 -0
- user_study_pairs/haze_235_diffdehaze.jpg +3 -0
- user_study_pairs/haze_235_flux.jpg +3 -0
- user_study_pairs/haze_235_nano_banana.jpg +3 -0
- user_study_pairs/haze_235_ours.jpg +3 -0
- user_study_pairs/haze_235_seedream.jpg +3 -0
- user_study_pairs/haze_28_dehazeformer.jpg +3 -0
- user_study_pairs/haze_28_diffdehaze.jpg +3 -0
- user_study_pairs/haze_28_flux.jpg +3 -0
- user_study_pairs/haze_28_nano_banana.jpg +3 -0
- user_study_pairs/haze_28_ours.jpg +3 -0
- user_study_pairs/haze_28_seedream.jpg +3 -0
- user_study_pairs/haze_2_dehazeformer.jpg +3 -0
- user_study_pairs/haze_2_diffdehaze.jpg +3 -0
- user_study_pairs/haze_2_flux.jpg +3 -0
- user_study_pairs/haze_2_nano_banana.jpg +3 -0
- user_study_pairs/haze_2_ours.jpg +3 -0
- user_study_pairs/haze_2_seedream.jpg +3 -0
- user_study_pairs/haze_30_dehazeformer.jpg +3 -0
- user_study_pairs/haze_30_diffdehaze.jpg +3 -0
- user_study_pairs/haze_30_flux.jpg +3 -0
- user_study_pairs/haze_30_nano_banana.jpg +3 -0
- user_study_pairs/haze_30_ours.jpg +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
import random
|
| 4 |
+
import pandas as pd
|
| 5 |
+
import time
|
| 6 |
+
from datetime import datetime
|
| 7 |
+
|
| 8 |
+
# ================= 配置区域 (Configuration) =================
|
| 9 |
+
|
| 10 |
+
# 图片所在的文件夹
|
| 11 |
+
IMAGE_DIR = "./user_study_pairs"
|
| 12 |
+
|
| 13 |
+
# 结果保存文件
|
| 14 |
+
RESULT_FILE = "user_study_results.csv"
|
| 15 |
+
|
| 16 |
+
# 每个任务抽取的样本数量 (修改为 5)
|
| 17 |
+
SAMPLES_PER_TASK = 5
|
| 18 |
+
|
| 19 |
+
# 任务列表 (文件名必须以这些开头)
|
| 20 |
+
TASKS = ['haze', 'shadow', 'reflections', 'lens_flares']
|
| 21 |
+
|
| 22 |
+
# 任务名称映射 (Task Names)
|
| 23 |
+
TASK_NAMES = {
|
| 24 |
+
'haze': {'cn': '雾霾', 'en': 'Fog/Haze'},
|
| 25 |
+
'shadow': {'cn': '阴影', 'en': 'Shadows'},
|
| 26 |
+
'reflections': {'cn': '玻璃反光', 'en': 'Reflections'},
|
| 27 |
+
'lens_flares': {'cn': '镜头光晕', 'en': 'Lens Flares'}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
# ================= 核心逻辑 (Core Logic) =================
|
| 31 |
+
|
| 32 |
+
def get_random_batch():
|
| 33 |
+
"""
|
| 34 |
+
从文件夹中按任务分层随机抽取样本。
|
| 35 |
+
Sample images stratified by task.
|
| 36 |
+
"""
|
| 37 |
+
if not os.path.exists(IMAGE_DIR):
|
| 38 |
+
return []
|
| 39 |
+
|
| 40 |
+
all_files = [f for f in os.listdir(IMAGE_DIR) if f.lower().endswith(('.jpg', '.jpeg', '.png'))]
|
| 41 |
+
selected_batch = []
|
| 42 |
+
|
| 43 |
+
for task in TASKS:
|
| 44 |
+
# 筛选出属于当前 task 的图片
|
| 45 |
+
task_files = [f for f in all_files if f.startswith(task)]
|
| 46 |
+
|
| 47 |
+
# 随机抽取 N 张
|
| 48 |
+
if len(task_files) >= SAMPLES_PER_TASK:
|
| 49 |
+
chosen = random.sample(task_files, SAMPLES_PER_TASK)
|
| 50 |
+
else:
|
| 51 |
+
chosen = task_files
|
| 52 |
+
|
| 53 |
+
for f in chosen:
|
| 54 |
+
full_path = os.path.join(IMAGE_DIR, f)
|
| 55 |
+
selected_batch.append((full_path, f, task))
|
| 56 |
+
|
| 57 |
+
random.shuffle(selected_batch)
|
| 58 |
+
return selected_batch
|
| 59 |
+
|
| 60 |
+
def save_result(user_id, results):
|
| 61 |
+
"""
|
| 62 |
+
保存结果到 CSV
|
| 63 |
+
Save results to CSV.
|
| 64 |
+
"""
|
| 65 |
+
data = []
|
| 66 |
+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 67 |
+
|
| 68 |
+
for img_name, task, is_success in results:
|
| 69 |
+
data.append({
|
| 70 |
+
"User_ID": user_id,
|
| 71 |
+
"Timestamp": timestamp,
|
| 72 |
+
"Image_Name": img_name,
|
| 73 |
+
"Task": task,
|
| 74 |
+
"Is_Success": is_success
|
| 75 |
+
})
|
| 76 |
+
|
| 77 |
+
df = pd.DataFrame(data)
|
| 78 |
+
|
| 79 |
+
if not os.path.exists(RESULT_FILE):
|
| 80 |
+
df.to_csv(RESULT_FILE, index=False, encoding='utf_8_sig')
|
| 81 |
+
else:
|
| 82 |
+
df.to_csv(RESULT_FILE, mode='a', header=False, index=False, encoding='utf_8_sig')
|
| 83 |
+
|
| 84 |
+
def generate_label_html(task_key):
|
| 85 |
+
"""
|
| 86 |
+
根据任务生成图片上方的标签(两栏或三栏)
|
| 87 |
+
Generate the label above the image based on the task (2-column or 3-column).
|
| 88 |
+
"""
|
| 89 |
+
if task_key == 'shadow':
|
| 90 |
+
# Shadow 任务使用三栏布局 (3-column layout for Shadow)
|
| 91 |
+
return """
|
| 92 |
+
<div class='big-label-container'>
|
| 93 |
+
<div style='flex:1;'>Input (输入原图)</div>
|
| 94 |
+
<div style='flex:1; border-left: 1px solid #ccc; border-right: 1px solid #ccc;'>Masked Shadow (阴影蒙版)</div>
|
| 95 |
+
<div style='flex:1;'>Output (修复结果)</div>
|
| 96 |
+
</div>
|
| 97 |
+
"""
|
| 98 |
+
else:
|
| 99 |
+
# 其他任务使用两栏布局 (2-column layout for others)
|
| 100 |
+
return """
|
| 101 |
+
<div class='big-label-container'>
|
| 102 |
+
<div style='flex:1;'>Input (输入原图)</div>
|
| 103 |
+
<div style='flex:1; border-left: 1px solid #ccc;'>Output (修复结果)</div>
|
| 104 |
+
</div>
|
| 105 |
+
"""
|
| 106 |
+
|
| 107 |
+
def generate_question_text(task_key):
|
| 108 |
+
"""
|
| 109 |
+
生成严格中英双语的问题描述
|
| 110 |
+
Generate strictly bilingual question descriptions.
|
| 111 |
+
"""
|
| 112 |
+
name_cn = TASK_NAMES.get(task_key, {}).get('cn', '干扰效应')
|
| 113 |
+
name_en = TASK_NAMES.get(task_key, {}).get('en', 'Artifacts')
|
| 114 |
+
|
| 115 |
+
# 针对 Shadow 任务的专用 Prompt
|
| 116 |
+
if task_key == 'shadow':
|
| 117 |
+
q1_cn = "1. <b>蒙版红色区域 (Masked Red Region)</b> 内的阴影是否去除干净?"
|
| 118 |
+
q1_en = "1. Is the shadow within the <b>Masked Red Region</b> removed cleanly?"
|
| 119 |
+
else:
|
| 120 |
+
q1_cn = f"1. 画面中的 <b>“{name_cn}”</b> 是否去除干净?"
|
| 121 |
+
q1_en = f"1. Is the <b>“{name_en}”</b> removed cleanly?"
|
| 122 |
+
|
| 123 |
+
text = f"""
|
| 124 |
+
<div class='question-box'>
|
| 125 |
+
<h3>请仔细评估 / Please Evaluate:</h3>
|
| 126 |
+
<p>{q1_cn}<br>
|
| 127 |
+
<span class='en-text'>{q1_en}</span></p>
|
| 128 |
+
<hr style='margin: 10px 0; opacity: 0.3;'>
|
| 129 |
+
<p>2. 原本的背景内容是否 <b>保持完整</b> 且未被篡改?<br>
|
| 130 |
+
<span class='en-text'>2. Is the original background <b>preserved</b> without distortion?</span></p>
|
| 131 |
+
</div>
|
| 132 |
+
"""
|
| 133 |
+
return text
|
| 134 |
+
|
| 135 |
+
# ================= 界面构建 (UI Layout) =================
|
| 136 |
+
|
| 137 |
+
with gr.Blocks(title="Visual Perception Study") as demo:
|
| 138 |
+
|
| 139 |
+
# CSS 样式:使用 Flexbox 确保标签与图片列对齐
|
| 140 |
+
gr.HTML("""
|
| 141 |
+
<style>
|
| 142 |
+
footer {visibility: hidden}
|
| 143 |
+
.big-label-container {
|
| 144 |
+
display: flex;
|
| 145 |
+
text-align: center;
|
| 146 |
+
font-weight: bold;
|
| 147 |
+
font-size: 1.1em;
|
| 148 |
+
color: #2c3e50;
|
| 149 |
+
background-color: #e8f4f8;
|
| 150 |
+
padding: 8px 0;
|
| 151 |
+
border-radius: 8px;
|
| 152 |
+
margin-bottom: 5px;
|
| 153 |
+
width: 100%;
|
| 154 |
+
}
|
| 155 |
+
.question-box {
|
| 156 |
+
background-color: #f9f9f9;
|
| 157 |
+
padding: 15px;
|
| 158 |
+
border-radius: 10px;
|
| 159 |
+
border: 1px solid #ddd;
|
| 160 |
+
margin-top: 10px;
|
| 161 |
+
}
|
| 162 |
+
.en-text {
|
| 163 |
+
color: #666;
|
| 164 |
+
font-style: italic;
|
| 165 |
+
font-size: 0.95em;
|
| 166 |
+
}
|
| 167 |
+
</style>
|
| 168 |
+
""")
|
| 169 |
+
|
| 170 |
+
# --- 状态变量 ---
|
| 171 |
+
state_batch = gr.State([])
|
| 172 |
+
state_index = gr.State(0)
|
| 173 |
+
state_results = gr.State([])
|
| 174 |
+
state_user_id = gr.State("")
|
| 175 |
+
|
| 176 |
+
# --- 页面 1: 欢迎页 ---
|
| 177 |
+
with gr.Group(visible=True) as welcome_page:
|
| 178 |
+
gr.Markdown("# 📋 图像修复主观质量评估 / Perceptual Image Restoration Study")
|
| 179 |
+
|
| 180 |
+
with gr.Row():
|
| 181 |
+
with gr.Column():
|
| 182 |
+
gr.Markdown("""
|
| 183 |
+
### 👋 欢迎 / Welcome
|
| 184 |
+
本研究旨在评估图像修复算法在真实场景下的表现。
|
| 185 |
+
This study evaluates the performance of image restoration algorithms in real-world scenarios.
|
| 186 |
+
|
| 187 |
+
### 🎯 评估标准 / Criteria for Success
|
| 188 |
+
请判断修复结果是否 **同时满足** 以下两个条件:
|
| 189 |
+
Please judge whether the restoration meets **BOTH** criteria:
|
| 190 |
+
|
| 191 |
+
* **1. 去除彻底 (Removal Effectiveness)**
|
| 192 |
+
中文: 干扰视觉的效应(如雾、影、反光)已基本消失。
|
| 193 |
+
English: The visual artifacts (haze, shadow, reflections) are effectively removed.
|
| 194 |
+
|
| 195 |
+
* **2. 保真度 (Content Fidelity)**
|
| 196 |
+
中文: 原图的背景物体、结构、颜色未被扭曲或篡改。
|
| 197 |
+
English: The original background structures, colors, and details are preserved without distortion.
|
| 198 |
+
""")
|
| 199 |
+
|
| 200 |
+
gr.Markdown(f"""
|
| 201 |
+
---
|
| 202 |
+
* **题目数量 / Questions**: {len(TASKS) * SAMPLES_PER_TASK}
|
| 203 |
+
* **匿名性 / Anonymity**: 结果仅用于学术统计 (Results are for academic use only).
|
| 204 |
+
""")
|
| 205 |
+
|
| 206 |
+
start_btn = gr.Button("开始测试 / Start Survey", variant="primary", size="lg")
|
| 207 |
+
|
| 208 |
+
# --- 页面 2: 测试页 ---
|
| 209 |
+
with gr.Group(visible=False) as quiz_page:
|
| 210 |
+
|
| 211 |
+
# 顶部进度
|
| 212 |
+
progress_md = gr.Markdown("### ⏳ Progress: 1 / 20")
|
| 213 |
+
|
| 214 |
+
# 图片显示区域
|
| 215 |
+
with gr.Column():
|
| 216 |
+
# 动态标签占位符 (Dynamic Label Placeholder)
|
| 217 |
+
label_html = gr.HTML(value="")
|
| 218 |
+
|
| 219 |
+
image_display = gr.Image(
|
| 220 |
+
label="",
|
| 221 |
+
interactive=False,
|
| 222 |
+
show_label=False,
|
| 223 |
+
container=True
|
| 224 |
+
)
|
| 225 |
+
|
| 226 |
+
# 问题区域
|
| 227 |
+
question_html = gr.HTML(value="Loading...")
|
| 228 |
+
|
| 229 |
+
# 按钮区域
|
| 230 |
+
with gr.Row():
|
| 231 |
+
btn_fail = gr.Button("❌ 失败 / Failure\n(没去干净 或 改了背景 / Incomplete or Distorted)", size="lg", variant="stop")
|
| 232 |
+
btn_pass = gr.Button("✅ 成功 / Success\n(去除干净 且 背景一致 / Clean & Preserved)", size="lg", variant="primary")
|
| 233 |
+
|
| 234 |
+
# --- 页面 3: 结束页 ---
|
| 235 |
+
with gr.Group(visible=False) as end_page:
|
| 236 |
+
gr.Markdown("""
|
| 237 |
+
# 🎉 感谢您的参与! / Thank You!
|
| 238 |
+
|
| 239 |
+
您的评估数据已成功提交。您可以直接关闭此页面。
|
| 240 |
+
Your evaluation data has been submitted. You may close this page now.
|
| 241 |
+
""")
|
| 242 |
+
|
| 243 |
+
# ================= 交互逻辑 =================
|
| 244 |
+
|
| 245 |
+
def start_survey():
|
| 246 |
+
batch = get_random_batch()
|
| 247 |
+
if not batch:
|
| 248 |
+
return {
|
| 249 |
+
welcome_page: gr.update(visible=True),
|
| 250 |
+
gr.State(""): "Error: No images found"
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
u_id = str(int(time.time()))
|
| 254 |
+
|
| 255 |
+
first_path, _, first_task = batch[0]
|
| 256 |
+
q_text = generate_question_text(first_task)
|
| 257 |
+
l_html = generate_label_html(first_task)
|
| 258 |
+
|
| 259 |
+
return {
|
| 260 |
+
welcome_page: gr.update(visible=False),
|
| 261 |
+
quiz_page: gr.update(visible=True),
|
| 262 |
+
end_page: gr.update(visible=False),
|
| 263 |
+
state_batch: batch,
|
| 264 |
+
state_index: 0,
|
| 265 |
+
state_results: [],
|
| 266 |
+
state_user_id: u_id,
|
| 267 |
+
image_display: first_path,
|
| 268 |
+
progress_md: f"### ⏳ Progress: 1 / {len(batch)}",
|
| 269 |
+
question_html: q_text,
|
| 270 |
+
label_html: l_html
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
def process_answer(is_success, index, batch, results, u_id):
|
| 274 |
+
# 记录答案
|
| 275 |
+
_, current_name, current_task = batch[index]
|
| 276 |
+
results.append((current_name, current_task, is_success))
|
| 277 |
+
|
| 278 |
+
next_index = index + 1
|
| 279 |
+
|
| 280 |
+
if next_index >= len(batch):
|
| 281 |
+
# 完成
|
| 282 |
+
save_result(u_id, results)
|
| 283 |
+
return {
|
| 284 |
+
quiz_page: gr.update(visible=False),
|
| 285 |
+
end_page: gr.update(visible=True)
|
| 286 |
+
}
|
| 287 |
+
else:
|
| 288 |
+
# 下一题
|
| 289 |
+
next_path, _, next_task = batch[next_index]
|
| 290 |
+
q_text = generate_question_text(next_task)
|
| 291 |
+
l_html = generate_label_html(next_task)
|
| 292 |
+
|
| 293 |
+
return {
|
| 294 |
+
state_index: next_index,
|
| 295 |
+
state_results: results,
|
| 296 |
+
image_display: next_path,
|
| 297 |
+
progress_md: f"### ⏳ Progress: {next_index + 1} / {len(batch)}",
|
| 298 |
+
question_html: q_text,
|
| 299 |
+
label_html: l_html
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
# 绑定事件
|
| 303 |
+
start_btn.click(
|
| 304 |
+
start_survey,
|
| 305 |
+
inputs=[],
|
| 306 |
+
outputs=[welcome_page, quiz_page, end_page, state_batch, state_index, state_results, state_user_id, image_display, progress_md, question_html, label_html]
|
| 307 |
+
)
|
| 308 |
+
|
| 309 |
+
btn_pass.click(
|
| 310 |
+
process_answer,
|
| 311 |
+
inputs=[gr.Number(1, visible=False), state_index, state_batch, state_results, state_user_id],
|
| 312 |
+
outputs=[quiz_page, end_page, state_index, state_results, image_display, progress_md, question_html, label_html]
|
| 313 |
+
)
|
| 314 |
+
|
| 315 |
+
btn_fail.click(
|
| 316 |
+
process_answer,
|
| 317 |
+
inputs=[gr.Number(0, visible=False), state_index, state_batch, state_results, state_user_id],
|
| 318 |
+
outputs=[quiz_page, end_page, state_index, state_results, image_display, progress_md, question_html, label_html]
|
| 319 |
+
)
|
| 320 |
+
|
| 321 |
+
if __name__ == "__main__":
|
| 322 |
+
demo.launch(share=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pandas
|
user_study_pairs/haze_203_dehazeformer.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_203_diffdehaze.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_203_flux.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_203_nano_banana.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_203_ours.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_203_seedream.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_205_dehazeformer.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_205_diffdehaze.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_205_flux.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_205_nano_banana.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_205_ours.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_205_seedream.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_224_dehazeformer.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_224_diffdehaze.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_224_flux.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_224_nano_banana.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_224_ours.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_224_seedream.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_225_dehazeformer.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_225_diffdehaze.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_225_flux.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_225_nano_banana.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_225_ours.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_225_seedream.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_235_dehazeformer.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_235_diffdehaze.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_235_flux.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_235_nano_banana.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_235_ours.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_235_seedream.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_28_dehazeformer.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_28_diffdehaze.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_28_flux.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_28_nano_banana.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_28_ours.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_28_seedream.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_2_dehazeformer.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_2_diffdehaze.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_2_flux.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_2_nano_banana.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_2_ours.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_2_seedream.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_30_dehazeformer.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_30_diffdehaze.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_30_flux.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_30_nano_banana.jpg
ADDED
|
Git LFS Details
|
user_study_pairs/haze_30_ours.jpg
ADDED
|
Git LFS Details
|