import tensorflow as tf from keras.models import load_model import gradio as gr from matplotlib import pyplot as plt model = load_model('eee.keras') def image_mod(image_mod): img = cv2.imread(image_mod) resize = tf.image.resize(img, (256, 256)) plt.imshow(resize.numpy().astype(int)) yhat = model.predict(np.expand_dims(resize,0)) display = np.max(yhat) return display gr.Interface(fn=image_mod, inputs=gr.Image(shape=(256, 256)), outputs=gr.Label(num_top_classes=3), examples=["Sunny_day_in_Hiroo.jpg","640px-Cloudy_Sky2.JPG","Foggy_day_of_Riga.jpg","Jida,_Zhuhai,_rainy_day.jpg","Odalys_Edenarc,_Arc_1800,_on_a_snowy_day,_2013.jpg"]).launch()