python prediction code

This commit is contained in:
Joshua Perry 2024-06-08 20:19:05 +01:00
parent a43dabfa85
commit fd069e9c8c
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import io
import tensorflow as tf
from PIL import Image
def predict(model_bytes, image_bytes):
model_file = io.BytesIO(model_bytes)
model = tf.keras.models.load(model_file)
image = Image.open(io.BytesIO(image_bytes))
return model.predict(image)