Spaces:
Runtime error
Runtime error
File size: 2,598 Bytes
199a42a 191f9fb 199a42a bce8e95 199a42a 191f9fb 5b27df7 9e4d2a6 462128d 9e4d2a6 462128d 5b27df7 7ba9fc9 f719dff 7ba9fc9 191f9fb 37695e4 54ac0d8 37695e4 af19131 37695e4 dc12171 37695e4 de6bdfa 37695e4 191f9fb 37695e4 dc12171 37695e4 f719dff 37695e4 191f9fb |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
import gradio as gr
import tensorflow as tf
path_to_model = "./skin_model_23_75.18.h5"
model = tf.keras.models.load_model(path_to_model)
labels = ['Acne / Rosacea',
'Actinic Keratosis / Basal Cell Carcinoma',
'Atopic Dermatitis', 'Bullous Disease',
'Cellulitis Impetigo (Bacterial Infections)',
'Eczema', 'Exanthems (Drug Eruptions)', 'Hair Loss (Alopecia)',
'Herpes HPV', 'Disorders of Pigmentation',
'Lupus ',
'Melanoma (Skin Cancer)', 'Nail Fungus',
'Poison Ivy',
'Psoriasis (Lichen Planus)', 'Scabies Lyme',
'Seborrheic Keratoses', 'Systemic Disease',
'Tinea Ringworm (Fungal Infections)',
'Urticaria Hives', 'Vascular Tumors', 'Vasculitis', 'Warts Molluscum']
def classify_image(photos):
photos = photos.reshape((-1, 224, 224, 3))
prediction = model.predict(photos).flatten()
confidences = {labels[i]: float(prediction[i]) for i in range(23)}
return confidences
title="SKIN DISEASE DETECTION"
description = "An automated system is proposed for the diagnosis of #23 common skin diseases by using data from clinical images and patient information using deep learning pre-trained EfficientNetB7 model with 75% accuracy. we will implement a simple image classification model using Gradio and Tensorflow. The image classification model will classify images of various skin disease problems into labeled classes."
article = "We used the generated Gradio UI to input an image for the trained convolutional neural network to make image classifications. The convolutional neural network was able to accurately classify the input image. Sometimes you would like to resize the image from the gradio UI for better performance"
examples = [
['./123.jpg'],
['./acne-closed-comedo-2.jpg'],
['./distal-subungual-onychomycosis-86.jpg'],
['./cherry-angioma-16.jpg'],
['./malignant-melanoma-16.jpg'],
['./tinea-primary-lesion-15.jpg'],
['./congenital-nevus-35.jpg'],
['./tinea-body-137.jpg']
]
gr.Interface(fn=classify_image,
title = title,
article = article,
description = description,
inputs=gr.inputs.Image(shape=(224, 224)),
outputs=gr.outputs.Label(num_top_classes=4),
examples=examples).launch()
|