Spaces:
Running
Running
File size: 510 Bytes
2b6c388 39d5866 2b6c388 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import os
import numpy as np
import gradio as gr
import tensorflow as tf
from tensorflow.keras.models import load_model
model = load_model('CloudDeploymentTest/model.keras')
labels = ["bird", "cat", "deer", "dog"]
def pred(input_img):
prediction = model.predict(np.array([input_img])/255) #/255 to normalize (rgb)
prediction = np.argmax(prediction)
prediction = labels[prediction]
return prediction
demo = gr.Interface(pred, gr.Image(), "text")
if __name__ == "__main__":
demo.launch() |