Spaces:
Sleeping
Sleeping
from keras.models import load_model | |
import cv2 | |
import json | |
import gradio as gr | |
model_data=load_model("SkinCancerModel.h5",compile=True) | |
f=open("data.json") | |
data=json.load(f) | |
cancer_class_list=list(data) | |
def Canccer_Prediction(image): | |
image=cv2.resize(image,(180,180))/255.0 | |
result=model_data.predict(image.reshape(1,180,180,3)).argmax() | |
return cancer_class_list[result],data[cancer_class_list[result]]['description'],data[cancer_class_list[result]]['symptoms'],data[cancer_class_list[result]]['causes'],data[cancer_class_list[result]]['treatement-1'],data[cancer_class_list[result]]['treatement-2'] | |
interface=gr.Interface(fn=Canccer_Prediction, | |
inputs="image", | |
outputs=[gr.components.Textbox(label="Cancer Name"),gr.components.Textbox(label="Description"),gr.components.Textbox(label="Symptoms"),gr.components.Textbox(label="Causes"),gr.components.Textbox(label="Treatment 1"),gr.components.Textbox(label="Treatment 2")], | |
enablue_queu=True) | |
interface.launch(debug=True) | |