azlan8289 commited on
Commit
f99b95c
·
verified ·
1 Parent(s): af6acf1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -17,7 +17,7 @@ labels = [
17
 
18
  def predict(image):
19
  image = np.array(image) # Ensure image is a numpy array
20
- image = tf.image.resize(image, (300, 300)) # Resize the image to match model input
21
  image = image / 255.0 # Normalize the image if your model expects pixel values in [0, 1]
22
  image = np.expand_dims(image, axis=0) # Add batch dimension
23
 
@@ -33,7 +33,7 @@ def predict(image):
33
 
34
  # Create Gradio interface
35
  iface = gr.Interface(fn=predict,
36
- inputs=gr.inputs.Image(shape=(300, 300)),
37
  outputs="text",
38
  title="Fruit Quality Classifier",
39
  description="Upload an image to classify it as fresh or rotten fruit.")
 
17
 
18
  def predict(image):
19
  image = np.array(image) # Ensure image is a numpy array
20
+ image = image.reshape((-1, 300, 300, 3)) # Resize the image to match model input
21
  image = image / 255.0 # Normalize the image if your model expects pixel values in [0, 1]
22
  image = np.expand_dims(image, axis=0) # Add batch dimension
23
 
 
33
 
34
  # Create Gradio interface
35
  iface = gr.Interface(fn=predict,
36
+ inputs=gr.inputs.Image,
37
  outputs="text",
38
  title="Fruit Quality Classifier",
39
  description="Upload an image to classify it as fresh or rotten fruit.")