|
|
|
|
|
|
|
import boto3 |
|
from boto.mturk.question import ExternalQuestion |
|
|
|
from config import MTURK_KEY, MTURK_SECRET |
|
|
|
MTURK_REGION = "us-east-1" |
|
MTURK_SANDBOX = "https://mturk-requester-sandbox.us-east-1.amazonaws.com" |
|
|
|
mturk = boto3.client( |
|
"mturk", |
|
aws_access_key_id=MTURK_KEY, |
|
aws_secret_access_key=MTURK_SECRET, |
|
region_name=MTURK_REGION, |
|
endpoint_url=MTURK_SANDBOX, |
|
) |
|
|
|
|
|
question = ExternalQuestion( |
|
"https://huggingface.co/spaces/Tristan/dadc/+", frame_height=600 |
|
) |
|
|
|
new_hit = mturk.create_hit( |
|
Title="DADC with Gradio", |
|
Description="Hello world", |
|
Keywords="fool the model", |
|
Reward="0.15", |
|
MaxAssignments=1, |
|
LifetimeInSeconds=172800, |
|
AssignmentDurationInSeconds=600, |
|
AutoApprovalDelayInSeconds=14400, |
|
Question=question.get_as_xml(), |
|
) |
|
|
|
print( |
|
"Sandbox link: https://workersandbox.mturk.com/mturk/preview?groupId=" |
|
+ new_hit["HIT"]["HITGroupId"] |
|
) |
|
|