Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ neural_net = load_learner('trained-NN.pkl')
|
|
| 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,11 +15,9 @@ description = 'Click an example photo or upload your own image!'
|
|
| 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'
|
|
|
|
| 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 |
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)
|
|
|
|
|
|