Spaces:
Runtime error
Runtime error
charlesouazana
commited on
Commit
•
35f9b83
1
Parent(s):
8c5e1ca
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
learn = load_learner('test.pkl')
|
5 |
+
|
6 |
+
|
7 |
+
categories = learn.dls.vocab
|
8 |
+
|
9 |
+
def classify_image(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float,probs)))
|
12 |
+
|
13 |
+
|
14 |
+
image = gr.inputs.Image(shape=(48, 48))
|
15 |
+
label = gr.outputs.Label()
|
16 |
+
examples = ['basset.jpg']
|
17 |
+
|
18 |
+
|
19 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
20 |
+
iface.launch()
|