boreavo commited on
Commit
b93de44
·
1 Parent(s): b01d5ab

let's deploy to huggingface spaces

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -1,9 +1,16 @@
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
  import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
 
5
+ learn = load_learner("export.pkl")
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
+
15
+ iface = gr.Interface(fn=predict, inputs="text", outputs="text")
16
  iface.launch()