Ian Cappellani commited on
Commit
d8acf03
1 Parent(s): 444534e
Files changed (2) hide show
  1. app.py +13 -4
  2. model.pkl +0 -3
app.py CHANGED
@@ -1,7 +1,16 @@
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
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
4
+ loaded_learn = load_learner("model.pkl")
 
5
 
6
+ categories = ('groban', 'not_groban')
7
+
8
+ def classify_image(img):
9
+ pred,idx,probs = loaded_learn.predict(img)
10
+ return dict(zip(categories, map(float,probs)))
11
+
12
+ image = gr.inputs.Image(shape=(128,128))
13
+ label = gr.outputs.label()
14
+
15
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
16
+ intf.launch(inline=False)
model.pkl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:afc98c5256c4e13fffc2d36e5986b356b5f2e3a205d2c9062a01862736be6e6e
3
- size 46966187