Spaces:
Runtime error
Runtime error
Tristan Thrush
commited on
Commit
•
89fbe02
1
Parent(s):
fb34e92
debug
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ with demo:
|
|
17 |
dummy = gr.Textbox(visible=False) # dummy for passing assignmentId
|
18 |
|
19 |
# We keep track of state as a Variable
|
20 |
-
state_dict = {"assignmentId": "", "cnt": 0, "fooled": 0, "data": [], "metadata": {}}
|
21 |
state = gr.Variable(state_dict)
|
22 |
|
23 |
gr.Markdown("# DADC in Gradio example")
|
@@ -65,10 +65,13 @@ with demo:
|
|
65 |
def _submit(state, dummy):
|
66 |
query = parse_qs(dummy[1:])
|
67 |
assert "assignmentId" in query, "No assignment ID provided, unable to submit"
|
68 |
-
state["assignmentId"] = query["assignmentId"]
|
|
|
|
|
|
|
69 |
url = "https://workersandbox.mturk.com/mturk/externalSubmit"
|
70 |
x = requests.post(url, data=state)
|
71 |
-
return str(x) + " With assignmentId " + state["assignmentId"] + "\n" + x.text, state, dummy
|
72 |
|
73 |
# Button event handlers
|
74 |
submit_ex_button.click(
|
|
|
17 |
dummy = gr.Textbox(visible=False) # dummy for passing assignmentId
|
18 |
|
19 |
# We keep track of state as a Variable
|
20 |
+
state_dict = {"assignmentId": "", "hitId": "", "workerId": "", "turkSubmitTo": "", "cnt": 0, "fooled": 0, "data": [], "metadata": {}}
|
21 |
state = gr.Variable(state_dict)
|
22 |
|
23 |
gr.Markdown("# DADC in Gradio example")
|
|
|
65 |
def _submit(state, dummy):
|
66 |
query = parse_qs(dummy[1:])
|
67 |
assert "assignmentId" in query, "No assignment ID provided, unable to submit"
|
68 |
+
state["assignmentId"] = query["assignmentId"]
|
69 |
+
state["hitId"] = query["hitId"]
|
70 |
+
state["workerId"] = query["workerId"]
|
71 |
+
state["turkSubmitTo"] = query["turkSubmitTo"]
|
72 |
url = "https://workersandbox.mturk.com/mturk/externalSubmit"
|
73 |
x = requests.post(url, data=state)
|
74 |
+
return str(x) + " With assignmentId " + state["assignmentId"][0] + "\n" + x.text, state, dummy
|
75 |
|
76 |
# Button event handlers
|
77 |
submit_ex_button.click(
|