Spaces:
Sleeping
Sleeping
File size: 1,059 Bytes
30e1b4b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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(img,(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)
|