test_gradio / app.py
John Smith
Update app.py
a4c1822
raw
history blame
745 Bytes
import tensorflow as tf
from keras.models import load_model
import gradio as gr
from matplotlib import pyplot as plt
import cv2
import numpy as np
model = load_model('eee.keras')
def image_mod(image_mod):
img = cv2.imread("Sušárna_a_panely.JPG")
resize = tf.image.resize(img, (256, 256))
plt.imshow(resize.numpy().astype(int))
yhat = model.predict(np.expand_dims(resize,0))
display = yhat
display = str(display)
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","Sušárna_a_panely.JPG"]).launch()