Exemplo n.º 1
0
import sys

sys.path.append("../../")
import VisipediaAPI as vis

# set up connection
vc = vis.Connection('../../config.yaml')

# GLOBALS
ANN_TYPE_ID = 4  # Use the dedicated test type
API_KEY_ID = 2  # Change this to your own key
ANN_INST_ID = 1135  # Change this to your own annotation instance

# To find your API keys, the following will return a list:
resp = vc.call('api_keys')
# then pick the 'id' of the API key you want to use

## create a new hit type
# set up the qualification requirements
qual_reqs = vis.yaml_field([
    vis.qual_field("00000000000000000071", "US", "eql"),  # US workers only
    vis.qual_field("000000000000000000L0", "95", "gte")
])  # >95% appr. rate
# create the hit type on the Visipedia server, but don't register it yet
resp = vc.call('hit_types',
               'create',
               params={
                   'identifier': 'Example Presence/Absence HIT',
                   'title': 'Example Test HIT',
                   'description': 'Test HIT to see if API works.',
                   'keywords': 'images,labeling,test,example',