Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,22 +25,21 @@ def predict(image):
|
|
| 25 |
custom_cnn_pred = custom_cnn_model.predict(np.expand_dims(processed_image, axis=0))[0]
|
| 26 |
|
| 27 |
# Get the predicted labels
|
| 28 |
-
vgg_label = np.argmax(vgg_pred
|
| 29 |
-
mobilenet_label = np.argmax(mobilenet_pred
|
| 30 |
-
custom_cnn_label = np.argmax(custom_cnn_pred
|
| 31 |
|
| 32 |
label_map = {0: 'Black Sea Sprat', 1: 'Gilt-Head Bream', 2: 'Hourse Mackerel',
|
| 33 |
3: 'Red Mullet', 4: 'Red Sea Bream', 5: 'Sea Bass',
|
| 34 |
6: 'Shrimp', 7: 'Striped Red Mullet', 8: 'Trout'}
|
| 35 |
-
label1 = [label_map[label] for label in custom_cnn_label][0]
|
| 36 |
-
label2 = [label_map[label] for label in vgg_label][0]
|
| 37 |
-
label3 = [label_map[label] for label in mobilenet_label][0]
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
return label1, label2, label3
|
| 43 |
|
|
|
|
| 44 |
# Create the Gradio interface
|
| 45 |
inputs = gr.components.Image()
|
| 46 |
outputs=[
|
|
|
|
| 25 |
custom_cnn_pred = custom_cnn_model.predict(np.expand_dims(processed_image, axis=0))[0]
|
| 26 |
|
| 27 |
# Get the predicted labels
|
| 28 |
+
vgg_label = np.argmax(vgg_pred)
|
| 29 |
+
mobilenet_label = np.argmax(mobilenet_pred)
|
| 30 |
+
custom_cnn_label = np.argmax(custom_cnn_pred)
|
| 31 |
|
| 32 |
label_map = {0: 'Black Sea Sprat', 1: 'Gilt-Head Bream', 2: 'Hourse Mackerel',
|
| 33 |
3: 'Red Mullet', 4: 'Red Sea Bream', 5: 'Sea Bass',
|
| 34 |
6: 'Shrimp', 7: 'Striped Red Mullet', 8: 'Trout'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
label1 = label_map[custom_cnn_label]
|
| 37 |
+
label2 = label_map[vgg_label]
|
| 38 |
+
label3 = label_map[mobilenet_label]
|
| 39 |
|
| 40 |
return label1, label2, label3
|
| 41 |
|
| 42 |
+
|
| 43 |
# Create the Gradio interface
|
| 44 |
inputs = gr.components.Image()
|
| 45 |
outputs=[
|