peazy commited on
Commit
5e10c40
1 Parent(s): a027420

Add application file

Browse files
Files changed (4) hide show
  1. app.py +22 -0
  2. broccoli.jpeg +3 -0
  3. export.pkl +3 -0
  4. marijuana.jpeg +3 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+ learn = load_learner('export.pkl')
4
+
5
+
6
+ categories = ('broccoli', 'marijuana')
7
+
8
+
9
+ def classify_image(img):
10
+ pred, idx, probs = learn.predict(img)
11
+ return dict(zip(categories, map(float, probs)))
12
+
13
+
14
+ image = gr.inputs.Image(shape=(192, 192))
15
+ label = gr.outputs.Label()
16
+
17
+ examples = ['broccoli.jpeg', 'marijuana.jpeg']
18
+
19
+ intf = gr.Interface(fn=classify_image, inputs=image,
20
+ outputs=label, examples=examples)
21
+
22
+ intf.launch(inline=False)
broccoli.jpeg ADDED

Git LFS Details

  • SHA256: ece62d89b8a6face8b0d681f17c42712ecb767dc4f613a54a7c3ead6cc566328
  • Pointer size: 131 Bytes
  • Size of remote file: 259 kB
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c809988609381e050146525eb00919eff7a0faf66334e19221148ae886bb1aa6
3
+ size 46966014
marijuana.jpeg ADDED

Git LFS Details

  • SHA256: 03bd915ac3d9be1bedf184dac9a6ec42fee550b5216125c6e2132f5442127657
  • Pointer size: 132 Bytes
  • Size of remote file: 1.47 MB