CNN-RESNET50/SEA
0
1import gradio as gr2import matplotlib.pyplot as plt3import PIL4import tensorflow as tf5from tensorflow import keras6from keras import layers7from keras.models import Sequential8from keras.preprocessing.image import ImageDataGenerator9import pathlib10from keras.models import Model11from PIL import Image12 13model = keras.models.load_model('model.h5')14class_names = ['GRACIER', 'SEA']15 16def predict_image(img):17 img_4d=img.reshape(1,224,224,3)18 prediction=model.predict(img_4d)[0]19 return {class_names[i]: float(prediction[i]) for i in range(2)}20 21image = gr.inputs.Image(shape=(224,224))22label = gr.outputs.Label(num_top_classes=2)23 24gr.Interface(css=None,25 fn=predict_image,26 inputs=image,27 description="",28 title='',outputs=label).launch(share=None)29 30gr.launch()31 32 