Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,10 @@ import numpy as np
|
|
| 8 |
# Load pre-trained ResNet50 model + higher level layers
|
| 9 |
model = ResNet50(weights='imagenet')
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
def classify_image(img):
|
| 12 |
# Resize the image to 224x224 pixels (required input size for ResNet50)
|
| 13 |
img = img.resize((224, 224))
|
|
@@ -32,7 +36,7 @@ iface = gr.Interface(
|
|
| 32 |
outputs=gr.Label(num_top_classes=3), # Output is a label with top 3 predictions
|
| 33 |
title="Contextual Image Classification",
|
| 34 |
description="Upload an image, and the model will classify it based on the context.",
|
| 35 |
-
examples
|
| 36 |
)
|
| 37 |
|
| 38 |
# Launch the interface
|
|
|
|
| 8 |
# Load pre-trained ResNet50 model + higher level layers
|
| 9 |
model = ResNet50(weights='imagenet')
|
| 10 |
|
| 11 |
+
|
| 12 |
+
chameleon = load_img("example_1.jpeg", output_type="pil")
|
| 13 |
+
|
| 14 |
+
|
| 15 |
def classify_image(img):
|
| 16 |
# Resize the image to 224x224 pixels (required input size for ResNet50)
|
| 17 |
img = img.resize((224, 224))
|
|
|
|
| 36 |
outputs=gr.Label(num_top_classes=3), # Output is a label with top 3 predictions
|
| 37 |
title="Contextual Image Classification",
|
| 38 |
description="Upload an image, and the model will classify it based on the context.",
|
| 39 |
+
examples=[chameleon],
|
| 40 |
)
|
| 41 |
|
| 42 |
# Launch the interface
|