Jekyll2000 commited on
Commit
16c5b4f
1 Parent(s): 1f9938f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from keras.models import load_model
2
+ import cv2
3
+ import json
4
+ import gradio as gr
5
+
6
+
7
+ model_result=load_model("fyp.h5",compile=True)
8
+
9
+ f=open("fyp file.json")
10
+ data=json.load(f)
11
+
12
+ Tumor_Classes=list(data)
13
+
14
+
15
+ def Tumor_Prediction(image):
16
+ image=cv2.resize(image,(32,32))/255.0
17
+ 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
+
22
+ interface=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)
26
+ interface.launch(debug=True)
27
+