reshane commited on
Commit
a78659f
·
1 Parent(s): 9c3920c

initial commit

Browse files
Files changed (2) hide show
  1. app.py +26 -0
  2. pepe.jpg +0 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from fastai.vision.all import *
3
+ import gradio as gr
4
+
5
+ def label_func(f): return f[0] == 'p'
6
+ def acc_camvid(*_): pass
7
+ def get_y(*_): pass
8
+
9
+ learner = load_learner('my_export.pkl')
10
+
11
+ categories = ('Poison Ivy', 'Not Poison Ivy')
12
+
13
+
14
+ def classify_image(img):
15
+ pred,idx,probs = learn.predict(img)
16
+ return dict(zip(categories, map(float,probs))
17
+
18
+ image = gr.inputs.Image(shape=(192, 192))
19
+ label = gr.outputs.Label()
20
+ examples = ["pepe.jpg"]
21
+
22
+
23
+
24
+ demo = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
25
+ demo.launch(inline=False)
26
+
pepe.jpg ADDED