Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,10 @@ labels = neural_net.dls.vocab
|
|
| 8 |
|
| 9 |
def predict(img):
|
| 10 |
# img = PILImage.create(img)
|
| 11 |
-
|
| 12 |
-
|
| 13 |
# return {'cat': 0.3, 'dog': 0.7}
|
| 14 |
-
return img.rotate(45)
|
| 15 |
|
| 16 |
title = 'Natural Landscape Classifier'
|
| 17 |
|
|
@@ -19,7 +19,7 @@ examples = ['farm.png']
|
|
| 19 |
|
| 20 |
iface = gr.Interface(fn=predict,
|
| 21 |
inputs=gr.Image(type='pil'),
|
| 22 |
-
outputs='
|
| 23 |
title=title,
|
| 24 |
examples=examples)
|
| 25 |
iface.launch(share=True)
|
|
|
|
| 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 |
# return {'cat': 0.3, 'dog': 0.7}
|
| 14 |
+
# return img.rotate(45)
|
| 15 |
|
| 16 |
title = 'Natural Landscape Classifier'
|
| 17 |
|
|
|
|
| 19 |
|
| 20 |
iface = gr.Interface(fn=predict,
|
| 21 |
inputs=gr.Image(type='pil'),
|
| 22 |
+
outputs='label',
|
| 23 |
title=title,
|
| 24 |
examples=examples)
|
| 25 |
iface.launch(share=True)
|