Rehman1603 commited on
Commit
30e1b4b
1 Parent(s): b36956e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from keras.models import load_model
2
+ import cv2
3
+ import json
4
+ import gradio as gr
5
+
6
+ model_data=load_model("SkinCancerModel.h5",compile=True)
7
+ f=open("data.json")
8
+
9
+ data=json.load(f)
10
+
11
+
12
+ cancer_class_list=list(data)
13
+
14
+
15
+ def Canccer_Prediction(image):
16
+ image=cv2.resize(img,(180,180))/255.0
17
+ result=model_data.predict(image.reshape(1,180,180,3)).argmax()
18
+
19
+ 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']
20
+
21
+
22
+ interface=gr.Interface(fn=Canccer_Prediction,
23
+ inputs="image",
24
+ 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")],
25
+ enablue_queu=True)
26
+ interface.launch(debug=True)
27
+
28
+