hb-setosys commited on
Commit
56ff650
·
verified ·
1 Parent(s): 68ae99e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import tensorflow as tf
3
  import numpy as np
4
  from tensorflow.keras.preprocessing import image
5
- from tensorflow.keras.applications.efficientnet_v2 import EfficientNetV2S, preprocess_input
6
  from PIL import Image
7
 
8
  # Load the trained model
@@ -18,7 +18,7 @@ def preprocess_image(img: Image.Image) -> np.ndarray:
18
  """Preprocess the image to match the model's input requirements."""
19
  img = img.resize((224, 224)) # Resize image to model input size
20
  img_array = np.array(img)
21
- img_array = EfficientNetV2S.preprocess_input(img_array) # EfficientNetV2 preprocessing
22
  img_array = np.expand_dims(img_array, axis=0) # Add batch dimension
23
  return img_array
24
 
 
2
  import tensorflow as tf
3
  import numpy as np
4
  from tensorflow.keras.preprocessing import image
5
+ from tensorflow.keras.applications.efficientnet_v2 import preprocess_input
6
  from PIL import Image
7
 
8
  # Load the trained model
 
18
  """Preprocess the image to match the model's input requirements."""
19
  img = img.resize((224, 224)) # Resize image to model input size
20
  img_array = np.array(img)
21
+ img_array = preprocess_input(img_array) # EfficientNetV2 preprocessing (correct usage)
22
  img_array = np.expand_dims(img_array, axis=0) # Add batch dimension
23
  return img_array
24