Skip to content

Instantly share code, notes, and snippets.

@sjain07
Created March 19, 2018 13:31
Show Gist options
  • Save sjain07/645bd82bd274c359a35a4e825f73a1c0 to your computer and use it in GitHub Desktop.
Save sjain07/645bd82bd274c359a35a4e825f73a1c0 to your computer and use it in GitHub Desktop.
import requests, os, sys
model_id = os.environ.get('NANONETS_MODEL_ID')
api_key = os.environ.get('NANONETS_API_KEY')
image_path = sys.argv[1]
url = 'https://app.nanonets.com/api/v2/ObjectDetection/Model/' + model_id + '/LabelFile/'
data = {'file': open(image_path, 'rb'), 'modelId': ('', model_id)}
response = requests.post(url, auth=requests.auth.HTTPBasicAuth(api_key, ''), files=data)
print(response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment