File size: 745 Bytes
3ff10a0
ab3f808
a4fcc7e
559ec57
24d3233
b9cfa97
9e95b47
24d3233
cd13712
a4c1822
0e74aec
 
 
1faf344
c357975
0e74aec
a4fcc7e
d365b80
98224c2
cd13712
a4c1822
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()