Langurmonkey commited on
Commit
039521e
·
verified ·
1 Parent(s): 62727b7

Fix worng syntax and examples.

Browse files
Files changed (5) hide show
  1. app.py +10 -6
  2. cat.jpg +0 -0
  3. dog.jpg +0 -0
  4. grizzly.jpg +0 -0
  5. teddy.jpg +0 -0
app.py CHANGED
@@ -5,14 +5,18 @@ def is_cat(x): return x[0].isupper()
5
 
6
  learn = load_learner('model.pkl')
7
 
8
- categories = ('Dog', 'Cat')
9
  def classify_image(img):
10
  pred,idx,probs = learn.predict(img)
11
  return dict(zip(categories, map(float,probs)))
12
 
13
- image = gr.inputs.Image(shape=(192, 192))
14
- label = gr.outputs.Label()
15
- examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
16
 
17
- intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, exmaples=examples)
18
- intf.launch(inline=False)
 
 
 
 
 
 
 
5
 
6
  learn = load_learner('model.pkl')
7
 
8
+ categories = ('Grizzly', 'Black', 'Teddy')
9
  def classify_image(img):
10
  pred,idx,probs = learn.predict(img)
11
  return dict(zip(categories, map(float,probs)))
12
 
13
+ examples = ['grizzly.jpg', 'teddy.jpg', 'dunno.jpg']
 
 
14
 
15
+ intf = gr.Interface(
16
+ fn=classify_image,
17
+ inputs=gr.Image(shape=(192, 192)),
18
+ outputs=gr.Label(),
19
+ examples=examples
20
+ )
21
+
22
+ intf.launch()
cat.jpg DELETED
Binary file (7.77 kB)
 
dog.jpg DELETED
Binary file (28 kB)
 
grizzly.jpg ADDED
teddy.jpg ADDED