Spaces:
Runtime error
Runtime error
Tristan Thrush
commited on
Commit
·
7a4749b
1
Parent(s):
6b8a006
debug
Browse files- app.py +2 -5
- collect.py +1 -1
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": "", "
|
| 21 |
state = gr.Variable(state_dict)
|
| 22 |
|
| 23 |
gr.Markdown("# DADC in Gradio example")
|
|
@@ -66,11 +66,8 @@ with demo:
|
|
| 66 |
query = parse_qs(dummy[1:])
|
| 67 |
assert "assignmentId" in query, "No assignment ID provided, unable to submit"
|
| 68 |
state["assignmentId"] = query["assignmentId"][0]
|
| 69 |
-
state["hitId"] = query["hitId"][0]
|
| 70 |
-
state["workerId"] = query["workerId"][0]
|
| 71 |
-
state["turkSubmitTo"] = query["turkSubmitTo"][0]
|
| 72 |
url = "https://workersandbox.mturk.com/mturk/externalSubmit"
|
| 73 |
-
x = requests.post(url, data=state)
|
| 74 |
return str(x) + " With assignmentId " + state["assignmentId"] + "\n" + x.text, state, dummy
|
| 75 |
|
| 76 |
# Button event handlers
|
|
|
|
| 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")
|
|
|
|
| 66 |
query = parse_qs(dummy[1:])
|
| 67 |
assert "assignmentId" in query, "No assignment ID provided, unable to submit"
|
| 68 |
state["assignmentId"] = query["assignmentId"][0]
|
|
|
|
|
|
|
|
|
|
| 69 |
url = "https://workersandbox.mturk.com/mturk/externalSubmit"
|
| 70 |
+
x = requests.post(url, data={"assignmentId": state["assignmentId"], "colorChoice": "blue"})
|
| 71 |
return str(x) + " With assignmentId " + state["assignmentId"] + "\n" + x.text, state, dummy
|
| 72 |
|
| 73 |
# Button event handlers
|
collect.py
CHANGED
|
@@ -24,7 +24,7 @@ question = ExternalQuestion("https://hf.space/embed/Tristan/dadc/+?__theme=light
|
|
| 24 |
|
| 25 |
new_hit = mturk.create_hit(
|
| 26 |
Title="DADC with Gradio",
|
| 27 |
-
Description="Hello
|
| 28 |
Keywords="fool the model",
|
| 29 |
Reward="0.15",
|
| 30 |
MaxAssignments=1,
|
|
|
|
| 24 |
|
| 25 |
new_hit = mturk.create_hit(
|
| 26 |
Title="DADC with Gradio",
|
| 27 |
+
Description="Hello",
|
| 28 |
Keywords="fool the model",
|
| 29 |
Reward="0.15",
|
| 30 |
MaxAssignments=1,
|