kellyshreeve commited on
Commit
66b47f7
·
verified ·
1 Parent(s): 9087e34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -7,6 +7,7 @@ neural_net = load_learner('trained-NN.pkl')
7
  labels = neural_net.dls.vocab
8
 
9
  def predict(img):
 
10
  category, idx, probs = neural_net.predict(img)
11
  return dict(zip(labels, map(float, probs)))
12
 
@@ -15,9 +16,11 @@ description = 'Click an example photo or upload your own image!'
15
  examples = ['farm.jpg', 'lake.jpg', 'solar.jpg', 'neighborhood.jpg']
16
 
17
  iface = gr.Interface(fn=predict,
18
- inputs=gr.Image(type='pil'),
19
  outputs='label',
20
  title=title,
21
  description=description,
22
  examples=examples)
23
- iface.launch(share=True)
 
 
 
7
  labels = neural_net.dls.vocab
8
 
9
  def predict(img):
10
+ img = PILImage.create(img)
11
  category, idx, probs = neural_net.predict(img)
12
  return dict(zip(labels, map(float, probs)))
13
 
 
16
  examples = ['farm.jpg', 'lake.jpg', 'solar.jpg', 'neighborhood.jpg']
17
 
18
  iface = gr.Interface(fn=predict,
19
+ inputs=gr.Image(),
20
  outputs='label',
21
  title=title,
22
  description=description,
23
  examples=examples)
24
+ iface.launch(share=True)
25
+
26
+ # type='pil'