Diego Carpintero commited on
Commit
42e90e2
1 Parent(s): 4bd8e36

update to gradio components

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -3,6 +3,8 @@ from fastai.vision.all import *
3
 
4
  title = "Interstellar Classifier"
5
  description = "Built for fast.ai 'Practical Deep Learning'"
 
 
6
  examples = "examples"
7
 
8
  model = load_learner("model/model.pkl")
@@ -10,15 +12,14 @@ labels = model.dls.vocab
10
 
11
 
12
  def predict(img):
13
- img = PILImage.create(img)
14
  pred, pred_idx, probs = model.predict(img)
15
  return dict(zip(labels, map(float, probs)))
16
 
17
 
18
  demo = gr.Interface(
19
  fn=predict,
20
- inputs=gr.inputs.Image(shape=(512, 512)),
21
- outputs="image",
22
  examples=examples,
23
  title=title,
24
  description=description,
 
3
 
4
  title = "Interstellar Classifier"
5
  description = "Built for fast.ai 'Practical Deep Learning'"
6
+ inputs = gr.components.Image()
7
+ outputs = gr.components.Label()
8
  examples = "examples"
9
 
10
  model = load_learner("model/model.pkl")
 
12
 
13
 
14
  def predict(img):
 
15
  pred, pred_idx, probs = model.predict(img)
16
  return dict(zip(labels, map(float, probs)))
17
 
18
 
19
  demo = gr.Interface(
20
  fn=predict,
21
+ inputs=inputs,
22
+ outputs=outputs,
23
  examples=examples,
24
  title=title,
25
  description=description,