Jekyll2000/Brain_Tumor_Classifcation_MRI_Based
0
1from keras.models import load_model2import cv23import json4import gradio as gr5 6 7model_result=load_model("fyp.h5",compile=True)8 9f=open("fyp file.json")10data=json.load(f)11 12Tumor_Classes=list(data)13 14 15def Tumor_Prediction(image):16 image=cv2.resize(image,(32,32))/255.017 result=model_result.predict(image.reshape(1,32,32,3)).argmax()18 19 return Tumor_Classes[result],data[Tumor_Classes[result]]['Description'],data[Tumor_Classes[result]]['Causes'],data[Tumor_Classes[result]]['Symptoms'],data[Tumor_Classes[result]]['Treatment']20 21 22interface=gr.Interface(fn=Tumor_Prediction,23 inputs="image",24 outputs=[gr.components.Textbox(label="Tumor Name"),gr.components.Textbox(label="Description"),gr.components.Textbox(label="Causes"),gr.components.Textbox(label="Symptoms"),gr.components.Textbox(label="Treatment")],25 enable_queu=True)26interface.launch(debug=True)27 