Rehman1603 commited on
Commit
a498913
1 Parent(s): 498337e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from keras.models import Model, load_model
3
+ import gradio as gr
4
+ import cv2
5
+
6
+
7
+ model = load_model('final_vgg1920epochs.h5', compile=True)
8
+
9
+ # Opening JSON file
10
+ f = open('dat.json')
11
+
12
+ # returns JSON object as
13
+ # a dictionary
14
+ data = json.load(f)
15
+
16
+ keys = list(data)
17
+
18
+
19
+ def Predict(image):
20
+ img = cv2.resize(image, (32,32)) / 255.0
21
+ prediction = model.predict(img.reshape(1,32,32,3))
22
+ print(prediction)
23
+
24
+
25
+ return keys[prediction.argmax()],data[keys[prediction.argmax()]]['description'],data[keys[prediction.argmax()]]['symptoms'],data[keys[prediction.argmax()]]['causes'],data[keys[prediction.argmax()]]['treatement-1']
26
+
27
+ demo=gr.Interface(fn=Predict,
28
+ inputs="image",
29
+ outputs=[gr.inputs.Textbox(label='Name Of Disease'),gr.inputs.Textbox(label='Description'),gr.inputs.Textbox(label='Symptoms'),gr.inputs.Textbox(label='Causes'),gr.inputs.Textbox(label='Treatement')],
30
+ title="Skin Disease Classification",
31
+ description='This Space predict these disease:\n \n1) Acne and Rosacea Photos. \n2) Actinic Keratosis Basal Cell Carcinoma and other Malignant Lesions.\n3) Eczema Photos. \n4) Melanoma Skin Cancer Nevi and Moles.\n5) Psoriasis pictures Lichen Planus and related diseases.\n6) Tinea Ringworm Candidiasis and other Fungal Infections.\n7) Urticaria Hives.\n8) Nail Fungus and other Nail Disease.\n')
32
+
33
+ demo.launch(debug=True)