vebie91 commited on
Commit
76e2cd8
1 Parent(s): 36bfe15

Update app.py

Browse files

update Gradio features

Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -10,7 +10,8 @@ import pathlib
10
  plt = platform.system()
11
  if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
12
 
13
- def is_cat(x): return x[0].isupper()
 
14
 
15
  learn = load_learner('model.pkl')
16
 
@@ -23,12 +24,16 @@ learn = load_learner('model.pkl')
23
  categories = ('Dog', 'Cat')
24
 
25
  def classify_image(img):
26
- pred,idx,probs = learn.predict(img)
27
  return dict(zip(categories, map(float,probs)))
28
 
29
- image = gr.inputs.Image(shape=(192, 192))
30
- label = gr.outputs.Label()
31
  examples = ['dog.jpg', 'cat.jpg']
32
 
33
- intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
 
 
 
 
34
  intf.launch(inline=False)
 
10
  plt = platform.system()
11
  if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
12
 
13
+ def is_cat(x):
14
+ return x[0].isupper()
15
 
16
  learn = load_learner('model.pkl')
17
 
 
24
  categories = ('Dog', 'Cat')
25
 
26
  def classify_image(img):
27
+ pred, idx, probs = learn.predict(img)
28
  return dict(zip(categories, map(float,probs)))
29
 
30
+ image = gr.Image()
31
+ label = gr.Label()
32
  examples = ['dog.jpg', 'cat.jpg']
33
 
34
+ intf = gr.Interface(
35
+ fn=classify_image,
36
+ inputs=image,
37
+ outputs=label,
38
+ examples=examples)
39
  intf.launch(inline=False)