elyx commited on
Commit
70c4ce0
·
1 Parent(s): 5843c1f
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,7 +1,15 @@
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
+ from fastcore import *
4
 
5
+ learn = load_learner('kitten.pkl')
 
6
 
7
+ classes = learn.dls.vocab
8
+
9
+ def classify_images(img):
10
+ img = PILimage.create(img)
11
+ pred,idx,prob = learn.predict(img)
12
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
13
+
14
+ iface = gr.Interface(fn=classify_images, inputs=gr.interface.Image(shape=(512, 512)), outputs=gr.interface.Label())
15
+ iface.launch()