dhadheechi commited on
Commit
92f5804
·
1 Parent(s): 2097f25

Upload 2 files

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