Cecilia Casarini commited on
Commit
e571df7
·
verified ·
1 Parent(s): 16a6180

Upload 4 files

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

Git LFS Details

  • SHA256: 871f22c872c51db04090832023707feac54a5569ef36439ab5f7015f8d1dc626
  • Pointer size: 130 Bytes
  • Size of remote file: 50.6 kB
vanillaorcoffee.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac49b7dcf2e7ccbf12f9d2bc1d9d0ae245f7432db6bf55ab2a4e92ee8638fbc8
3
+ size 46957615