from mlforkids import MLforKidsImageProject # treat this key like a password and keep it secret! key = "bbdf2510-ab32-11eb-b9b5-a98e843d496781e6b159-7cb9-471e-8b4d-b257831c4688" # this will train your model and might take a little while myproject = MLforKidsImageProject(key) myproject.train_model() # CHANGE THIS to the image file you want to recognize demo = myproject.prediction("my-test-image.jpg") label = demo["class_name"] confidence = demo["confidence"] # CHANGE THIS to do something different with the result print ("result: '%s' with %d%% confidence" % (label, confidence))
To use this code, you need to:
- Use Python 3
- Download this list of other Python modules you need
- Install the other Python modules by running
pip install -r mlforkids-requirements.txt
- Download mlforkids.py to the folder where you will run your Python code