Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot generate "model id" from step4 #2

Open
GhadaJouini opened this issue Sep 15, 2020 · 4 comments
Open

Cannot generate "model id" from step4 #2

GhadaJouini opened this issue Sep 15, 2020 · 4 comments

Comments

@GhadaJouini
Copy link

when I run the command : "python ./code/training.py" the "model_id" is not generated, and this error occurs:

Traceback (most recent call last):
File "./code/training.py", line 10, in
model = OCR(API_KEY, CATEGORIES)
File "/usr/local/lib/python3.6/dist-packages/nanonets/ocr.py", line 17, in init
self.create_model(categories)
File "/usr/local/lib/python3.6/dist-packages/nanonets/ocr.py", line 46, in create_model
self.model_id = response.json()["model_id"]
KeyError: 'model_id'

any solution how to fix this and thanks :)

@rushabhnagda11
Copy link
Contributor

Have you set NANONETS_API_KEY as an env variable?

@GhadaJouini
Copy link
Author

yes using this command " !export NANONETS_API_KEY= my API key" @rushabhnagda11

@CloneHub94
Copy link

I also get this error. Citing an error 500(Internal server error) when I print response
image
:

@CloneHub94
Copy link

This is the code inside my training.py file:

import os
from nanonets import OCR

API_KEY = os.environ.get('NANONETS_API_KEY')
CATEGORIES = ['name', 'sex', 'date_of_birth', 'address', 'dl_number', 'issue_date', 'exp_date', 'class', 'height', 'restrictions', 'eyes']

IMAGE_DIR = './images/'
ANNOTATION_DIR = './annotations/json/'

model = OCR(API_KEY, CATEGORIES)

images = [IMAGE_DIR + x for x in os.listdir(IMAGE_DIR)]
images.sort()

annotations = [ANNOTATION_DIR + x for x in os.listdir(ANNOTATION_DIR)]
annotations.sort()

training_dict = dict(zip(images, annotations))

response = model.train(training_dict)

print("NEXT RUN: export NANONETS_MODEL_ID=" + model.model_id)
print("NEXT RUN: python ./code/model-state.py")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants