Multiple images in a HIT with python API

0

Hello,
I am trying to create a HIT in MTurk using the python API. Let say a single HIT has 3 images. How would I modify the api call mturk.create_hit to replace the URL of the 3 images in my XML code? I believe the call is something like this:
.....
response = mturk.create_hit(**task_attributes,
Question = questions_xml.replace('${image_url}', ....))
hit_type_id = response['HIT']['HITTypeId'] ....

So basically, how would I change the 'Question' attribute to replace the 3 image_url?
Thanks

pallavr
已提問 5 年前檢視次數 203 次
2 個答案
0

Start by updating the task template captured in the questions_xml variable to include separate references to the three images you want to place there: ${image1_url}, ${image2_url}, and ${image3_url}. Then you can update your create step to replace all of the variables as shown below.

Question = questions_xml.replace('${image1_url}', ....).replace('${image2_url}', ....).replace('${image3_url}', ....)

已回答 5 年前
0

Thanks!

pallavr
已回答 5 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南