Spaces:
Runtime error
Runtime error
Daniel K.Gunleiksrud
commited on
Commit
•
a86e5be
1
Parent(s):
40732fe
changed to muffin
Browse files- app.py +13 -3
- dog.PNG +0 -0
- muffin.PNG +0 -0
app.py
CHANGED
@@ -1,7 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
+
learn = load_learner('model.pkl')
|
|
|
5 |
|
6 |
+
categories = ('Muffin', 'Chihuahua')
|
7 |
+
|
8 |
+
def classify(img):
|
9 |
+
pred,_,probs = learn.predict(img)
|
10 |
+
return dict(zip(categories, map(float,probs)))
|
11 |
+
|
12 |
+
image = gr.inputs.Image(shape=(192,192))
|
13 |
+
label = gr.outputs.Label()
|
14 |
+
examples = ['muffin.png', 'dog.png']
|
15 |
+
|
16 |
+
iface = gr.Interface(fn=classify, inputs=image, outputs=label, examples=examples)
|
17 |
iface.launch()
|
dog.PNG
ADDED
|
muffin.PNG
ADDED
|