Tristan Thrush commited on
Commit
d876d62
1 Parent(s): 5bd8508

added html question

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. collect.py +21 -3
app.py CHANGED
@@ -66,7 +66,7 @@ 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"]
69
- url = "https://workersandbox.mturk.com/mturk/externalSubmit"
70
  return requests.post(url, data=state)
71
 
72
  # Button event handlers
 
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/htmlSubmit"
70
  return requests.post(url, data=state)
71
 
72
  # Button event handlers
collect.py CHANGED
@@ -2,7 +2,7 @@
2
  # For more information see https://docs.aws.amazon.com/mturk/index.html
3
 
4
  import boto3
5
- from boto.mturk.question import ExternalQuestion
6
 
7
  from config import MTURK_KEY, MTURK_SECRET
8
 
@@ -18,8 +18,26 @@ mturk = boto3.client(
18
  )
19
 
20
  # The + in the URL makes the Space easily embeddable in an iframe
21
- question = ExternalQuestion(
22
- "https://huggingface.co/spaces/Tristan/dadc/+", frame_height=600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  )
24
 
25
  new_hit = mturk.create_hit(
 
2
  # For more information see https://docs.aws.amazon.com/mturk/index.html
3
 
4
  import boto3
5
+ from boto.mturk.question import HTMLQuestion
6
 
7
  from config import MTURK_KEY, MTURK_SECRET
8
 
 
18
  )
19
 
20
  # The + in the URL makes the Space easily embeddable in an iframe
21
+ question = HTMLQuestion(
22
+ """
23
+ <!DOCTYPE html>
24
+ <html>
25
+ <head>
26
+ <meta charset="utf-8" />
27
+ <meta name="viewport" content="width=device-width" />
28
+ <title>My static Space</title>
29
+ <link rel="shortcut icon" href="#" type="image/x-icon">
30
+ <link rel="stylesheet" href="style.css" />
31
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>
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>
39
+ """,
40
+ frame_height=600
41
  )
42
 
43
  new_hit = mturk.create_hit(