Spaces:
Build error
Build error
Update app.py
Browse files16 unmodified lines171819202122239 unmodified lines3334353637383916 unmodified linesdef predict(image):image = np.array(image) # Ensure image is a numpy arrayimage = tf.image.resize(image, (300, 300)) # Resize the image to match model inputimage = image / 255.0 # Normalize the image if your model expects pixel values in [0, 1]image = np.expand_dims(image, axis=0) # Add batch dimension9 unmodified lines# Create Gradio interfaceiface = gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(300, 300)),outputs="text",title="Fruit Quality Classifier",description="Upload an image to classify it as fresh or rotten fruit.")16 unmodified lines171819202122239 unmodified lines3334353637383916 unmodified linesdef predict(image):image = np.array(image) # Ensure image is a numpy arrayimage = image.reshape((-1, 300, 300, 3)) # Resize the image to match model inputimage = image / 255.0 # Normalize the image if your model expects pixel values in [0, 1]image = np.expand_dims(image, axis=0) # Add batch dimension9 unmodified lines# Create Gradio interfaceiface = gr.Interface(fn=predict,inputs=gr.inputs.Image,outputs="text",title="Fruit Quality Classifier",description="Upload an image to classify it as fresh or rotten fruit.")
app.py+2-2