Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ scheduler = CommitScheduler(
|
|
| 38 |
repo_type="dataset",
|
| 39 |
folder_path=LOG_FOLDER,
|
| 40 |
path_in_repo="logs",
|
| 41 |
-
every=1, # 每1
|
| 42 |
token=TOKEN
|
| 43 |
)
|
| 44 |
|
|
@@ -227,8 +227,26 @@ with gr.Blocks(title="User Study") as demo:
|
|
| 227 |
|
| 228 |
md_end = gr.Markdown(visible=False)
|
| 229 |
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
repo_type="dataset",
|
| 39 |
folder_path=LOG_FOLDER,
|
| 40 |
path_in_repo="logs",
|
| 41 |
+
every=1, # 每1分钟同步一次
|
| 42 |
token=TOKEN
|
| 43 |
)
|
| 44 |
|
|
|
|
| 227 |
|
| 228 |
md_end = gr.Markdown(visible=False)
|
| 229 |
|
| 230 |
+
# 初始加载
|
| 231 |
+
demo.load(
|
| 232 |
+
fn=get_next_question,
|
| 233 |
+
inputs=[state_user],
|
| 234 |
+
outputs=[img_origin, gallery_candidates, checkbox_options, md_instruction, btn_submit, btn_none, md_end, state_user, state_candidates_info]
|
| 235 |
+
)
|
| 236 |
|
| 237 |
+
# 提交按钮事件
|
| 238 |
+
btn_submit.click(
|
| 239 |
+
fn=lambda s, c, o: save_and_next(s, c, o, is_none=False),
|
| 240 |
+
inputs=[state_user, state_candidates_info, checkbox_options],
|
| 241 |
+
outputs=[img_origin, gallery_candidates, checkbox_options, md_instruction, btn_submit, btn_none, md_end, state_user, state_candidates_info]
|
| 242 |
+
)
|
| 243 |
|
| 244 |
+
# 都不满意按钮事件
|
| 245 |
+
btn_none.click(
|
| 246 |
+
fn=lambda s, c, o: save_and_next(s, c, o, is_none=True),
|
| 247 |
+
inputs=[state_user, state_candidates_info, checkbox_options],
|
| 248 |
+
outputs=[img_origin, gallery_candidates, checkbox_options, md_instruction, btn_submit, btn_none, md_end, state_user, state_candidates_info]
|
| 249 |
+
)
|
| 250 |
+
|
| 251 |
+
if __name__ == "__main__":
|
| 252 |
+
demo.launch()
|