Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,19 +14,20 @@ for filename in os.listdir(directory):
|
|
14 |
allImages.append(f)
|
15 |
|
16 |
def flower_classifier(image):
|
17 |
-
|
18 |
image = tf.image.resize(image, (224, 224))
|
19 |
image = image / 255.0
|
20 |
image = tf.expand_dims(image, 0)
|
21 |
-
pred =
|
22 |
-
|
23 |
-
return
|
24 |
|
25 |
|
26 |
iface = gr.Interface(flower_classifier,
|
27 |
-
title = "
|
28 |
-
examples = allImages,
|
29 |
inputs = gr.inputs.Image(),
|
30 |
outputs = gr.outputs.Label(num_top_classes=5),
|
31 |
-
capture_session=True
|
|
|
|
|
32 |
iface.launch(debug=True)
|
|
|
14 |
allImages.append(f)
|
15 |
|
16 |
def flower_classifier(image):
|
17 |
+
print(image.shape)
|
18 |
image = tf.image.resize(image, (224, 224))
|
19 |
image = image / 255.0
|
20 |
image = tf.expand_dims(image, 0)
|
21 |
+
pred = np.argmax(model(image))
|
22 |
+
label = CLASSES[pred]
|
23 |
+
return label
|
24 |
|
25 |
|
26 |
iface = gr.Interface(flower_classifier,
|
27 |
+
title = "Image Classification using BigTransfer (BiT)",
|
|
|
28 |
inputs = gr.inputs.Image(),
|
29 |
outputs = gr.outputs.Label(num_top_classes=5),
|
30 |
+
capture_session=True,
|
31 |
+
examples = allImages[:4],
|
32 |
+
)
|
33 |
iface.launch(debug=True)
|