Vol*_*il3 3 python mechanicalturk boto3
我正在使用这里给出的教程。它说 HIT 已创建,但是当我去这里时,https://requestersandbox.mturk.com/我没有找到我创建的项目。尽管单个工作程序 URL 确实返回 HIT Web 界面。
我想知道的原因是我不仅要自动化 HIT 创建,还要自动化批处理的发布。我的代码如下:
MTURK_SANDBOX = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'
mturk = boto3.client('mturk',
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET,
region_name='us-east-1',
endpoint_url=MTURK_SANDBOX
)
print("I have $" + mturk.get_account_balance()['AvailableBalance'] + " in my Sandbox account")
question = open('questions.xml', encoding='utf8').read()
new_hit = mturk.create_hit(
Title='Is this Tweet happy, angry, excited, scared, annoyed or upset?',
Description='Read this tweet and type out one word to describe the emotion of the person posting it: happy, angry, scared, annoyed or upset',
Keywords='text, quick, labeling',
Reward='0.15',
MaxAssignments=1,
LifetimeInSeconds=172800,
AssignmentDurationInSeconds=600,
AutoApprovalDelayInSeconds=14400,
Question=question,
)
print("A new HIT has been created. You can preview it here:")
print("https://workersandbox.mturk.com/mturk/preview?groupId=" + new_hit['HIT']['HITGroupId'])
print("HITID = " + new_hit['HIT']['HITId'] + " (Use to Get Results)")
Run Code Online (Sandbox Code Playgroud)
Mechanical Turk 目前不提供通过 API 发布一批 HIT 的方法。您必须分别呼叫CreateHIT他们中的每一个。
此外,通过 API 创建的 HIT 在 UI 中不可见。您可以通过 API 看到这些。您还可以使用 AWS 命令行 shell 来管理它们,因为它也使用 API。
资料来源:
| 归档时间: |
|
| 查看次数: |
705 次 |
| 最近记录: |