AliSaria commited on
Commit
a6ceefb
·
verified ·
1 Parent(s): c79c64c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -13,7 +13,10 @@ def predict_and_visualize(img):
13
  # Store the original image size
14
  original_size = img.size
15
 
16
-
 
 
 
17
 
18
  # Make a prediction
19
  prediction = model.predict(img_array)
@@ -39,4 +42,4 @@ iface = gr.Interface(
39
  )
40
 
41
  # Launch the Gradio app
42
- iface.launch()
 
13
  # Store the original image size
14
  original_size = img.size
15
 
16
+ # Convert the input image to the target size expected by the model
17
+ img_resized = img.resize((224,224))
18
+ img_array = np.array(img_resized) / 255.0 # Normalize the image
19
+ img_array = np.expand_dims(img_array, axis=0) # Add batch dimension
20
 
21
  # Make a prediction
22
  prediction = model.predict(img_array)
 
42
  )
43
 
44
  # Launch the Gradio app
45
+ iface.launch()