Syahhh01's picture
Create app.py
7fbc827 verified
# app.py
import tensorflow as tf
import numpy as np
from PIL import Image
model = tf.keras.models.load_model('.')
def predict(image):
# Preprocess image
image = image.resize((224, 224))
image_array = np.array(image) / 255.0
image_array = np.expand_dims(image_array, axis=0)
# Predict
predictions = model.predict(image_array)
return predictions[0]