Spaces:
Sleeping
Sleeping
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() |