jonathan-roos commited on
Commit
343f370
1 Parent(s): 7d1af22

changed app.py to use model.pkl. Also added model and 3 example images to use

Browse files
Files changed (5) hide show
  1. app.py +12 -3
  2. bat1.png +0 -0
  3. bat2.png +0 -0
  4. model.pkl +3 -0
  5. not_bat.png +0 -0
app.py CHANGED
@@ -1,7 +1,16 @@
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
 
4
+ learn = load_learner('model.pkl')
 
5
 
6
+
7
+ def classify_bat(img):
8
+ label,_,probs = learn.predict(img)
9
+ return dict(zip(label, map(float, probs)))
10
+
11
+ image = gr.inputs.Image(shape=(200, 200))
12
+ label = gr.outputs.label()
13
+ examples = ['bat1.png', 'bat2.png', 'not_bat.png']
14
+
15
+ iface = gr.Interface(fn=classify_bat, inputs=image, outputs=label)
16
  iface.launch()
bat1.png ADDED
bat2.png ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a698e2165ecc0b8ecbc238d7ea72c250023cf6af034b31a7108e04268656bbe0
3
+ size 102895971
not_bat.png ADDED