Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ def classify_image(image):
|
|
14 |
# Load and preprocess the image
|
15 |
img = load_img(image, target_size=(150, 150)) # Ensure this matches the input size of your model
|
16 |
img_array = img_to_array(img) / 255.0 # Normalize pixel values
|
17 |
-
img_array = np.expand_dims(img_array, axis
|
18 |
|
19 |
# Log the shape of the image array for debugging
|
20 |
print(f"Image shape for prediction: {img_array.shape}")
|
@@ -29,8 +29,8 @@ def classify_image(image):
|
|
29 |
|
30 |
# Gradio interface
|
31 |
iface = gr.Interface(fn=classify_image,
|
32 |
-
inputs=gr.
|
33 |
-
outputs=gr.
|
34 |
title="Boy or Girl Classifier",
|
35 |
description="Upload an image to classify it as either a Boy or a Girl.")
|
36 |
|
|
|
14 |
# Load and preprocess the image
|
15 |
img = load_img(image, target_size=(150, 150)) # Ensure this matches the input size of your model
|
16 |
img_array = img_to_array(img) / 255.0 # Normalize pixel values
|
17 |
+
img_array = np.expand_dims(img_array, axis=0) # Reshape for the model input (1, 150, 150, 3)
|
18 |
|
19 |
# Log the shape of the image array for debugging
|
20 |
print(f"Image shape for prediction: {img_array.shape}")
|
|
|
29 |
|
30 |
# Gradio interface
|
31 |
iface = gr.Interface(fn=classify_image,
|
32 |
+
inputs=gr.Image(type="filepath"),
|
33 |
+
outputs=gr.Textbox(),
|
34 |
title="Boy or Girl Classifier",
|
35 |
description="Upload an image to classify it as either a Boy or a Girl.")
|
36 |
|