def main(): logging.info("Reading & parsing arguments...") args = read_arguments() logging.info("Reading predictions files") with open(args.annotations_path, 'r') as f: configuration = yaml.safe_load(f) predictions = configuration['predictions'] logging.info("Connecting to Kili") kauth = KiliAuth(email=args.email, password=args.password, api_endpoint=args.api_endpoint) playground = Playground(kauth) logging.info("Getting predictions") external_id_array = [ get(prediction, 'externalId') for prediction in predictions ] json_response_array = [ json.loads(get(prediction, 'response')) for prediction in predictions ] logging.info("Uploading to Kili") playground.create_predictions(project_id=args.project_id, external_id_array=external_id_array, json_response_array=json_response_array)
def main(api_endpoint): email = input('Enter email: ') password = getpass.getpass() project_id = input('Enter project id: ') with open('./conf/new_assets.yml', 'r') as f: configuration = yaml.safe_load(f) assets = configuration['assets'] kauth = KiliAuth(email, password, api_endpoint) playground = Playground(kauth) project = playground.get_project(project_id=project_id) roles = get(project, 'roles') for asset in tqdm(assets): external_id = get(asset, 'externalId') to_be_labeled_by = [ get(user, 'email') for user in get(asset, 'toBeLabeledBy') ] asset = get_asset_by_external_id(playground, project_id, external_id) asset_id = get(asset, 'id') playground.update_properties_in_asset( asset_id=asset_id, to_be_labeled_by=to_be_labeled_by)
def main(api_endpoint): email = input('Enter email: ') password = getpass.getpass() source_project_id = input( 'Enter project IDs (separate them by "," if you want to provide several): ' ) kauth = KiliAuth(email=email, password=password, api_endpoint=api_endpoint) playground = Playground(kauth) df = pd.DataFrame(columns=['Project', 'Date', 'Email']) for project_id in source_project_id.split(','): project = playground.projects(project_id=project_id)[0] assets = playground.assets(project_id=project_id) title = project['title'] for asset in assets: for label in asset['labels']: created_at = label['createdAt'][:10] author_email = label['author']['email'] df = df.append( { 'Project': title, 'Date': created_at, 'Email': author_email }, ignore_index=True) df_grouped = df.groupby(['Project', 'Date', 'Email']).size() time = datetime.now().strftime('%Y%m%d%H%M') df_grouped.to_excel(f'labeler-stats-{time}.xlsx')
def __init__(self, email, password, api_endpoint, project_id, minimum_number_of_assets_to_launch_training=100): kauth = KiliAuth(email, password, api_endpoint=api_endpoint) self.playground = Playground(kauth) self.project_id = project_id self.current_training_number = 0 self.last_training_number = -1 self.assets_seen_in_training = [] self.minimum_number_of_assets_to_launch_training = minimum_number_of_assets_to_launch_training
def main(api_endpoint): api_key = input('Enter API KEY: ') project_id = input('Enter project id: ') title = input( 'Enter a new title (leave blank and press [Enter] to leave title as is): ').strip() description = input( 'Enter a new description (leave blank and press [Enter] to leave description as is): ').strip() kauth = KiliAuth(api_key=api_key, api_endpoint=api_endpoint) playground = Playground(kauth) playground.update_properties_in_project( project_id=project_id, title=title, description=description)
def main(api_endpoint): api_key = input('Enter API KEY: ') project_id = input('Enter project id: ') instructions = input( 'Enter link to instructions (leave blank and press [Enter] to disable instructions): ' ).strip() if not instructions.startswith('http') and not instructions == '': raise Exception( 'The link to instructions should be an URL beginning in http:// or https://' ) kauth = KiliAuth(api_key=api_key, api_endpoint=api_endpoint) playground = Playground(kauth) playground.update_properties_in_project(project_id=project_id, instructions=instructions)
def __init__(self, api_key, api_endpoint, project_id, number_of_inferences, minimum_number_of_assets_to_launch_training=100): kauth = KiliAuth(api_key=api_key, api_endpoint=api_endpoint) self.playground = Playground(kauth) self.project_id = project_id self.current_inference_number = 0 self.current_training_number = 0 self.last_training_number = -1 self.assets_seen_in_training = [] self.minimum_number_of_assets_to_launch_training = minimum_number_of_assets_to_launch_training self.number_of_inferences = number_of_inferences
def main(api_endpoint): email = input('Enter email: ') password = getpass.getpass() project_id = input('Enter project id: ') title = input( 'Enter a new title (leave blank and press [Enter] to leave title as is): ' ).strip() description = input( 'Enter a new description (leave blank and press [Enter] to leave description as is): ' ).strip() kauth = KiliAuth(email, password, api_endpoint=api_endpoint) playground = Playground(kauth) playground.update_properties_in_project(project_id=project_id, title=title, description=description)
def main(api_endpoint): email = input('Enter Email: ') password = getpass.getpass('Enter password for user {}:'.format(email)) kauth = KiliAuth(email, password, api_endpoint=api_endpoint) playground = Playground(kauth) project_id = input('Enter project id: ') # Check and load new predictions STOP_CONDITION = True while STOP_CONDITION: tools = playground.get_tools(project_id=project_id) assert len(tools) == 1 categories = list( json.loads(tools[0]['jsonSettings'])['categories'].keys()) print('Export assets and labels...') assets = playground.export_assets(project_id=project_id) print('Done.\n') X, y, X_to_be_predicted, ids_X_to_be_predicted = extract_train_for_autoML( assets, categories) if len(X) > 5: print('Online Learning is on its way...') predictions = automl_train_and_predict(X, y, X_to_be_predicted) # Insert pre-annotations for i, prediction in enumerate(tqdm(predictions)): json_response = { 'categories': [{ 'name': categories[prediction], 'confidence': 100 }] } id = ids_X_to_be_predicted[i] playground.create_prediction(asset_id=id, json_response=json_response) print('Done.\n') time.sleep(SECONDS_BETWEEN_TRAININGS)
def __init__(self, email, password, api_endpoint, project_id): kauth = KiliAuth(email, password, api_endpoint=api_endpoint) self.playground = Playground(kauth) self.project_id = project_id
return dic[key] email = input('Enter email: ') password = getpass.getpass() project_id = input('Enter project id: ') with open('./conf/new_users.yml', 'r') as f: configuration = yaml.safe_load(f) users = configuration['users'] DEFAULT_ORGANIZATION_ROLE = 'USER' kauth = KiliAuth(email, password) playground = Playground(kauth) organization_id = playground.get_user(email=email)['organization']['id'] for user in tqdm(users): user_name = get(user, 'name') user_email = get(user, 'email') user_password = get(user, 'password') playground.create_user(name=user_name, email=user_email, password=user_password, organization_id=organization_id, organization_role=DEFAULT_ORGANIZATION_ROLE) user_role = get(user, 'role') playground.append_to_roles(project_id=project_id, user_email=user_email,