Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,13 +15,13 @@ def import_and_predict(image_data):
|
|
15 |
x /= 255
|
16 |
x=np.expand_dims(x, axis=0)
|
17 |
image = np.vstack([x])
|
18 |
-
prediction = model.predict(image)
|
19 |
labels=class_names
|
20 |
confidences = {labels[i]: float(prediction[i]) for i in range(15)}
|
21 |
return confidences
|
22 |
|
23 |
gr.Interface(fn=import_and_predict,
|
24 |
-
inputs=gr.Image(shape=(224, 224)),
|
25 |
-
outputs=gr.Label(num_top_classes=3)
|
26 |
|
27 |
#examples=["banana.jpg", "car.jpg"]
|
|
|
15 |
x /= 255
|
16 |
x=np.expand_dims(x, axis=0)
|
17 |
image = np.vstack([x])
|
18 |
+
prediction = model.predict(image)[0]
|
19 |
labels=class_names
|
20 |
confidences = {labels[i]: float(prediction[i]) for i in range(15)}
|
21 |
return confidences
|
22 |
|
23 |
gr.Interface(fn=import_and_predict,
|
24 |
+
inputs=gr.inputs.Image(shape=(224, 224)),
|
25 |
+
outputs=gr.outputs.Label(num_top_classes=3).launch()
|
26 |
|
27 |
#examples=["banana.jpg", "car.jpg"]
|