import gradio as gr import tensorflow as tf from tensorflow.keras.models import load_model import numpy as np from tensorflow.keras.preprocessing import image def predict_input_image(img): img = img.reshape(-1,224,224,3) # Make predictions model = tf.keras.models.load_model('Tumor_Model.h5') prediction = model.predict(img_array) result = 'No Tumor Detected' if prediction[0][0] > 0.5 else 'Tumor detected' return f"Prediction: {result}" # Define Gradio interface iface = gr.Interface( fn=predict_input_image, inputs=gr.Image(type = 'pil'), outputs="text", ) # Launch the interface iface.launch()