kaesb commited on
Commit
40b1780
·
1 Parent(s): ad79c86

Added application file and pickle file

Browse files
Files changed (2) hide show
  1. app.py +12 -0
  2. cat_dog_model.pkl +3 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('cat_dog_model.pkl')
5
+ labels = learn.dls.vocab
6
+
7
+ def predict(img):
8
+ img = PILImage.create(img)
9
+ pred,pred_idx,probs = learn.predict(img)
10
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
11
+
12
+ gr.Interface(fn=predict, inputs=gr.components.Image(shape=(512, 512)), outputs=gr.components.Label(num_top_classes=3)).launch(share=True)
cat_dog_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a0c96c356fcb0d4252eb473251c2a7c142d31f65878c7f9a4a7d415e498f68d
3
+ size 46959339