szili2011 commited on
Commit
e9dec91
1 Parent(s): f46e6ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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-1) # 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,8 +29,8 @@ def classify_image(image):
29
 
30
  # Gradio interface
31
  iface = gr.Interface(fn=classify_image,
32
- inputs=gr.inputs.Image(type="filepath"),
33
- outputs=gr.outputs.Textbox(),
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