Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created January 22, 2021 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/50c7fa4d81d436eece4ab5ae62026972 to your computer and use it in GitHub Desktop.
Save amankharwal/50c7fa4d81d436eece4ab5ae62026972 to your computer and use it in GitHub Desktop.
learn =cnn_learner(dls,
resnet34,
metrics = error_rate)
learn.fine_tune(1)
import ipywidgets as widgets
uploader = widgets.FileUpload()
uploader
def pred():
img = PILImage.create(uploader.data[0])
img.show()
#Make Prediction
is_cat,_,probs = learn.predict(img)
print(f"Image is of a Cat: {is_cat}.")
print(f"Probability image is a cat: {probs[1].item():.6f}")
pred()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment