dpersson commited on
Commit
ce8eb7d
1 Parent(s): b91f233

adding model and demo to git

Browse files
Files changed (3) hide show
  1. export.pkl +3 -0
  2. gradio-demo.py +14 -0
  3. requirements.txt +2 -0
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4de02508181dd6e8c9b4c5d29e9e737b1c9f10557b9d267f5a18a2c0b21e87aa
3
+ size 103040701
gradio-demo.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('export.pkl')
5
+
6
+ labels = learn.dls.vocab
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
+ demo = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3))
13
+
14
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image