jules241 commited on
Commit
53048fd
1 Parent(s): 4518a1a
app.py CHANGED
@@ -1,9 +1,15 @@
 
1
  import gradio as gr
2
 
 
3
 
4
- def greet(name):
5
- return "Hello " + name + "!!"
6
 
7
 
8
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
9
- iface.launch()
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ learn = load_learner('model.pkl')
5
 
6
+ labels = learn.dls.vocab
 
7
 
8
 
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.inputs.Image(shape=(512, 512)),
15
+ outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
bear_classifier.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
images/grizzly.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:482059b84e3b71c60f5b9ffc6b1d13ddaefe98ab76e1f942667d5325f362a311
3
+ size 46967509
model.pklZone.Identifier ADDED
File without changes
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image