tkdrnjs0621 commited on
Commit
3c35862
·
verified ·
1 Parent(s): cb62a14

fix: gr.Request injection on submit (keyword-only -> positional); E2E tested

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -103,7 +103,8 @@ def start(rater, request: gr.Request):
103
  return (gr.update(visible=False), gr.update(visible=True), q, a, b, t,
104
  _progress(), rater, item_id)
105
 
106
- def submit(rater, item_id, *choices, request: gr.Request):
 
107
  if (request.query_params.get("key") or "") != ACCESS_KEY:
108
  raise gr.Error("접근 키가 없습니다.")
109
  n_out = 6 + len(AXES)
@@ -140,4 +141,5 @@ with gr.Blocks(title="Chart A/B Evaluation") as demo:
140
  start_btn.click(start, [rater_in], [gate, panel, qmd, img_a, img_b, tbl, prog, rater_st, item_st])
141
  sub_btn.click(submit, [rater_st, item_st, *radios], [qmd, img_a, img_b, tbl, prog, item_st, *radios])
142
 
143
- demo.launch()
 
 
103
  return (gr.update(visible=False), gr.update(visible=True), q, a, b, t,
104
  _progress(), rater, item_id)
105
 
106
+ def submit(rater, item_id, c1, c2, c3, c4, request: gr.Request):
107
+ choices = (c1, c2, c3, c4)
108
  if (request.query_params.get("key") or "") != ACCESS_KEY:
109
  raise gr.Error("접근 키가 없습니다.")
110
  n_out = 6 + len(AXES)
 
141
  start_btn.click(start, [rater_in], [gate, panel, qmd, img_a, img_b, tbl, prog, rater_st, item_st])
142
  sub_btn.click(submit, [rater_st, item_st, *radios], [qmd, img_a, img_b, tbl, prog, item_st, *radios])
143
 
144
+ if __name__ == "__main__":
145
+ demo.launch()