|
from PIL import Image |
|
import cv2 |
|
import numpy as np |
|
|
|
import tensorflow as tf |
|
from keras.models import load_model |
|
|
|
import gradio as gr |
|
|
|
model =load_model('BrainTumor10Epochs.h5') |
|
|
|
def getResult(inp): |
|
|
|
inp=np.array(inp) |
|
input_img = np.expand_dims(inp, axis=0) |
|
result=np.max(model.predict(input_img)) |
|
|
|
if result==0: |
|
return "No Brain Tumor" |
|
elif result==1: |
|
|
|
return "Yes Brain Tumor" |
|
|
|
|
|
iface=gr.Interface(fn=getResult, |
|
inputs=gr.Image(shape=(64, 64)), |
|
outputs=gr.Label(num_top_classes=2), |
|
) |
|
if __name__ == "__main__": |
|
iface.launch() |