Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import matplotlib.pyplot as plt
|
|
3 |
import numpy as np
|
4 |
from collections import namedtuple
|
5 |
from mxnet.gluon.data.vision import transforms
|
6 |
-
from mxnet.contrib.onnx.onnx2mx.import_model import import_model
|
7 |
import os
|
8 |
import gradio as gr
|
9 |
|
@@ -56,7 +55,7 @@ def predict(path):
|
|
56 |
a = np.argsort(-outputs[0].flatten())
|
57 |
results = {}
|
58 |
for i in a[0:5]:
|
59 |
-
results[
|
60 |
return results
|
61 |
|
62 |
|
@@ -64,4 +63,4 @@ title="AlexNet"
|
|
64 |
description="AlexNet is the name of a convolutional neural network for classification, which competed in the ImageNet Large Scale Visual Recognition Challenge in 2012."
|
65 |
|
66 |
examples=[['catonnx.jpg']]
|
67 |
-
gr.Interface(predict,gr.inputs.Image(type='filepath'),"label",title=title,description=description,examples=examples).launch(enable_queue=True)
|
|
|
3 |
import numpy as np
|
4 |
from collections import namedtuple
|
5 |
from mxnet.gluon.data.vision import transforms
|
|
|
6 |
import os
|
7 |
import gradio as gr
|
8 |
|
|
|
55 |
a = np.argsort(-outputs[0].flatten())
|
56 |
results = {}
|
57 |
for i in a[0:5]:
|
58 |
+
results[labels[i]]=float(outputs[0][0][i])
|
59 |
return results
|
60 |
|
61 |
|
|
|
63 |
description="AlexNet is the name of a convolutional neural network for classification, which competed in the ImageNet Large Scale Visual Recognition Challenge in 2012."
|
64 |
|
65 |
examples=[['catonnx.jpg']]
|
66 |
+
gr.Interface(predict,gr.inputs.Image(type='filepath'),"label",title=title,description=description,examples=examples).launch(enable_queue=True,debug=True)
|