Emilyxml commited on
Commit
82a791c
·
verified ·
1 Parent(s): 6cc8dbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
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
- demo.load(fn=get_next_question, inputs=[state_user], outputs=[img_origin, gallery_candidates, checkbox_options, md_instruction, btn_submit, btn_none, md_end, state_user, state_candidates_info])
 
 
 
 
 
231
 
232
- btn_submit.click(fn=lambda s, c, o: save_and_next(s, c, o, is_none=False), inputs=[state_user, state_candidates_info, checkbox_options], outputs=[img_origin, gallery_candidates, checkbox_options, md_instruction, btn_submit, btn_none, md_end, state_user, state_candidates_info])
 
 
 
 
 
233
 
234
- btn_none.click(fn=lambda s, c, o: save_and_next(s, c, o, is_none=True), inputs=[state_user, state_candidates_info, checkbox
 
 
 
 
 
 
 
 
 
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()