Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ class_labels = [
|
|
30 |
|
31 |
def classify_image(img):
|
32 |
pred, idx, probs = learn.predict(img)
|
33 |
-
|
34 |
img = Image.fromarray((img * 255).astype(np.uint8))
|
35 |
img = img.resize((224, 224))
|
36 |
img_array = tf.keras.preprocessing.image.img_to_array(img)
|
@@ -39,8 +39,9 @@ def classify_image(img):
|
|
39 |
|
40 |
predictions = model.predict(img_array)
|
41 |
predicted_class = class_labels[np.argmax(predictions)]
|
|
|
42 |
|
43 |
-
return
|
44 |
|
45 |
|
46 |
iface = gr.Interface(
|
|
|
30 |
|
31 |
def classify_image(img):
|
32 |
pred, idx, probs = learn.predict(img)
|
33 |
+
|
34 |
img = Image.fromarray((img * 255).astype(np.uint8))
|
35 |
img = img.resize((224, 224))
|
36 |
img_array = tf.keras.preprocessing.image.img_to_array(img)
|
|
|
39 |
|
40 |
predictions = model.predict(img_array)
|
41 |
predicted_class = class_labels[np.argmax(predictions)]
|
42 |
+
highest_prob_index = probs.argmax()
|
43 |
|
44 |
+
return categories[highest_prob_index]
|
45 |
|
46 |
|
47 |
iface = gr.Interface(
|