python prediction code
This commit is contained in:
parent
a43dabfa85
commit
fd069e9c8c
|
|
@ -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)
|
||||||
Loading…
Reference in New Issue