Spaces:
Runtime error
Runtime error
harshaUwm163
commited on
Commit
·
6ef9453
1
Parent(s):
571a99f
added table in output
Browse files
app.py
CHANGED
@@ -37,8 +37,6 @@ def read_image(image):
|
|
37 |
print(image.shape)
|
38 |
# plt.imshow(image)
|
39 |
# plt.show()
|
40 |
-
# image = tf.image.resize(images=image, size=[IMG_SIZE, IMG_SIZE])
|
41 |
-
# image = image / 127.5 - 1
|
42 |
image, _ = preprocess_image(image, 1) # 1 here is a temporary label
|
43 |
return image
|
44 |
|
@@ -47,11 +45,9 @@ def infer(input_image):
|
|
47 |
image_tensor = read_image(input_image)
|
48 |
print(image_tensor.shape)
|
49 |
predictions = model.predict(np.expand_dims((image_tensor), axis=0))
|
50 |
-
predictions = np.squeeze(predictions)
|
51 |
-
predictions = np.argmax(predictions) # , axis=2
|
52 |
-
predicted_label = class_names[predictions.item()]
|
53 |
-
return str(predicted_label)
|
54 |
|
|
|
55 |
|
56 |
# get the inputs
|
57 |
input = gr.inputs.Image(shape=(IMG_SIZE, IMG_SIZE))
|
|
|
37 |
print(image.shape)
|
38 |
# plt.imshow(image)
|
39 |
# plt.show()
|
|
|
|
|
40 |
image, _ = preprocess_image(image, 1) # 1 here is a temporary label
|
41 |
return image
|
42 |
|
|
|
45 |
image_tensor = read_image(input_image)
|
46 |
print(image_tensor.shape)
|
47 |
predictions = model.predict(np.expand_dims((image_tensor), axis=0))
|
48 |
+
predictions = np.squeeze(predictions).astype(float)
|
|
|
|
|
|
|
49 |
|
50 |
+
return dict(zip(class_names, predictions))
|
51 |
|
52 |
# get the inputs
|
53 |
input = gr.inputs.Image(shape=(IMG_SIZE, IMG_SIZE))
|