danieladejumo commited on
Commit
3eb4884
1 Parent(s): d97f49f

Updated application file

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -1,7 +1,19 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return f"Hello {name}! It's nice to have you on thi space."
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
 
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()