Spaces:
Sleeping
Sleeping
danieladejumo
commited on
Commit
•
3eb4884
1
Parent(s):
d97f49f
Updated application file
Browse files
app.py
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
+
learn = load_learner("bird_or_forest.pkl")
|
5 |
+
classes = ["Bird", "Forest"]
|
6 |
|
7 |
+
def classify_images(im):
|
8 |
+
cat, idx, probs = learn.predict(im)
|
9 |
+
return dict(zip(classes, map(float, probs)))
|
10 |
+
|
11 |
+
image = gr.Inputs.Image(shape=(192, 192))
|
12 |
+
label = gr.Outputs.Label()
|
13 |
+
examples = ["forest.jpg", "bird.jpg"]
|
14 |
+
|
15 |
+
iface = gr.Interface(fn=classify_images,
|
16 |
+
inputs=image,
|
17 |
+
outputs=label,
|
18 |
+
examples=examples)
|
19 |
iface.launch()
|