Beispiel #1
0
# 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',
                   'reward': 1,
                   'assignment_duration': 500,
                   'auto_approval_delay': 2592000,
                   'annotation_type_id': ANN_TYPE_ID,
                   'api_key_id': API_KEY_ID,
Beispiel #2
0
# 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',
                        'reward' : 1,
                        'assignment_duration' : 500,
                        'auto_approval_delay' : 2592000,
                        'annotation_type_id' : ANN_TYPE_ID,
                        'api_key_id' : API_KEY_ID,
                        'sandbox' : 1,
                        'qualification_requirement' : qual_reqs,
                        'register' : 0})