Abdul09's picture
Update app.py
6ac284f
import gradio as gr
import numpy as np
# load the trained CNN model
cnn_model = keras.models.load_model("fine_tuning.keras")
def Normal_or_Pneumonia(img):
img = img.reshape( -1, 180, 180,3 )
prediction = cnn_model .predict(img).tolist()[0]
CLASS_NAMES = ["PNEUMONIA DETECTOR"]
return {CLASS_NAMES[i]: prediction[i] for i in range(1)}
#set the user uploaded image as the input array
#match same shape as the input shape in the model
image_input = gr.inputs.Image( shape=(180, 180) ,invert_colors=False , type="numpy" )
#setup the interface
iface = gr.Interface(
fn = Normal_or_Pneumonia,
inputs = image_input,
outputs = gr.outputs.Label(),
)
iface.launch(share=True , debug = True)