cybernatedArt commited on
Commit
8472257
1 Parent(s): f6df97a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import tensorflow as tf
3
+ import numpy as np
4
+ import requests
5
+ from tensorflow.keras.applications.resnet50 import ResNet50
6
+ from tensorflow.keras.applications.resnet50 import preprocess_input
7
+ from tensorflow.keras.models import load_model
8
+
9
+ model = tf.keras.models.load_model('model_2.h5')
10
+
11
+ #function
12
+ def example(image):
13
+ image = image.reshape(-1, 256, 256, 3)
14
+ prediction = model.predict(image).flatten()
15
+ #return {class_names[i]: float(prediction[i]) for i in range(4)}
16
+ class_names = ['Acne and Rosacea Photos', 'Actinic Keratosis Basal Cell Carcinoma and other Malignant Lesions', 'Atopic Dermatitis Photos', 'Bullous Disease Photos', 'Cellulitis Impetigo and other Bacterial Infections', 'Eczema Photos', 'Exanthems and Drug Eruptions', 'Hair Loss Photos Alopecia and other Hair Diseases', 'Herpes HPV and other STDs Photos', 'Light Diseases and Disorders of Pigmentation', 'Lupus and other Connective Tissue diseases', 'Melanoma Skin Cancer Nevi and Moles', 'Nail Fungus and other Nail Disease', 'Poison Ivy Photos and other Contact Dermatitis', 'Psoriasis pictures Lichen Planus and related diseases', 'Scabies Lyme Disease and other Infestations and Bites', 'Seborrheic Keratoses and other Benign Tumors', 'Systemic Disease', 'Tinea Ringworm Candidiasis and other Fungal Infections', 'Urticaria Hives', 'Vascular Tumors', 'Vasculitis Photos', 'Warts Molluscum and other Viral Infections']
17
+ return {class_names[i]: float(prediction[i]) for i in range(23)}
18
+
19
+
20
+ # initializing the input component
21
+ image = gr.inputs.Image(shape = (256, 256))
22
+ # initializing the output component
23
+ label = gr.outputs.Label(num_top_classes = 4)
24
+
25
+ # launching the interface
26
+ gr.Interface(fn = example,
27
+ inputs = image,outputs = label,capture_session = True,
28
+ title="SKIN DISEASE PREDICTION",
29
+ description= "An automated system is proposed for the
30
+ diagnosis of #23 common skin diseases by using data from clinical images and patient information using deep learning pre-trained ResNet50
31
+ model.").launch(share=True)