Tristan Thrush commited on
Commit
96e0ce2
1 Parent(s): 73f2dfd
Files changed (2) hide show
  1. app.py +6 -2
  2. collect.py +1 -1
app.py CHANGED
@@ -65,9 +65,12 @@ with demo:
65
  def _submit(state, dummy):
66
  query = parse_qs(dummy[1:])
67
  assert "assignment_id" in query, "No assignment ID provided, unable to submit"
68
- state["assignment_id"] = query["assignment_id"]
69
  url = "https://workersandbox.mturk.com/mturk/externalSubmit"
70
- return requests.post(url, data=state)
 
 
 
71
 
72
  # Button event handlers
73
  submit_ex_button.click(
@@ -81,5 +84,6 @@ with demo:
81
  outputs=None,
82
  _js="function(state, dummy) { return [state, window.location.search]; }",
83
  )
 
84
 
85
  demo.launch()
 
65
  def _submit(state, dummy):
66
  query = parse_qs(dummy[1:])
67
  assert "assignment_id" in query, "No assignment ID provided, unable to submit"
68
+ state["assignmentId"] = query["assignment_id"]
69
  url = "https://workersandbox.mturk.com/mturk/externalSubmit"
70
+ x = requests.post(url, data=state)
71
+ print(x)
72
+ print(x.text)
73
+ return x
74
 
75
  # Button event handlers
76
  submit_ex_button.click(
 
84
  outputs=None,
85
  _js="function(state, dummy) { return [state, window.location.search]; }",
86
  )
87
+ #gr.Markdown(state["response"].text if "response" in state and state["response"] is not None else "")
88
 
89
  demo.launch()
collect.py CHANGED
@@ -32,7 +32,7 @@ question = HTMLQuestion(
32
  <script type="module" crossorigin src="https://gradio.s3-us-west-2.amazonaws.com/3.0.17/gradio.js"></script>
33
  </head>
34
  <body>
35
- <gradio-app space="Tristan/dadc{window.location.search}"></gradio-app>
36
 
37
  </body>
38
  </html>
 
32
  <script type="module" crossorigin src="https://gradio.s3-us-west-2.amazonaws.com/3.0.17/gradio.js"></script>
33
  </head>
34
  <body>
35
+ <gradio-app space="Tristan/dadc"></gradio-app>
36
 
37
  </body>
38
  </html>