SEA / app.py
CNN-RESNET50's picture
Create new file
9d97baa
import gradio as gr
import matplotlib.pyplot as plt
import PIL
import tensorflow as tf
from tensorflow import keras
from keras import layers
from keras.models import Sequential
from keras.preprocessing.image import ImageDataGenerator
import pathlib
from keras.models import Model
from PIL import Image
model = keras.models.load_model('model.h5')
class_names = ['sea', 'glacier']
def predict_image(img):
img_4d=img.reshape(1,224,224,3)
prediction=model.predict(img_4d)[0]
return {class_names[i]: float(prediction[i]) for i in range(2)}
image = gr.inputs.Image(shape=(224,224))
label = gr.outputs.Label(num_top_classes=2)
gr.Interface(css=None,
fn=predict_image,
inputs=image,
description="Please upload a Chest X-Ray image in JPG, JPEG or PNG.",
title='Identifying Adenoid by Convolutional neural network',outputs=label).launch(share=None)
gr.launch()