File size: 381 Bytes
7fbc827 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# 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] |