File size: 2,026 Bytes
8472257
 
 
 
 
 
 
 
3ef5f2a
8472257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63b8c06
 
0a2ee2c
63b8c06
a677d6b
63b8c06
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
29
30
31
import gradio as gr
import tensorflow as tf 
import numpy as np
import requests
from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.applications.resnet50 import preprocess_input
from tensorflow.keras.models import load_model

model = tf.keras.models.load_model('model_2.h5')

#function
def example(image):
 image = image.reshape(-1, 256, 256, 3)
 prediction = model.predict(image).flatten()
#return {class_names[i]: float(prediction[i]) for i in range(4)}
 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']
 return {class_names[i]: float(prediction[i]) for i in range(23)}
 
 
 # initializing the input component
image = gr.inputs.Image(shape = (256, 256)) 
# initializing the output component 
label = gr.outputs.Label(num_top_classes = 4)

# launching the interface

title = "SKIN DISEASE PREDICTION"
description = "An automated system is proposed for the diagnosis of #23 common skin diseases by using data from clinical images and patient information."

# launching the interface
gr.Interface(fn = example,inputs = image,outputs = label,capture_session = True, title=title,description= description ).launch(share=True)