skin9 / app.py
cybernatedArt's picture
Create new file
08f8648
raw
history blame
1.88 kB
import gradio as gr
import tensorflow as tf
path_to_model = "./skin_9_84.23.h5"
model = tf.keras.models.load_model(path_to_model)
labels = ['Actinic Keratosis Basal Cell', 'Atopic Dermatitis Photos', 'Eczema', 'Melanoma', 'Nail Fungus','Psoriasis','Seborrheic Keratoses', 'Tinea Ringworm', '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 PREDICTION"
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 ResNet50 model. 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 = [
['./actinic-cheilitis-sq-cell-lip-47.jpg'],
['./atypical-nevi-25.jpg'],
['./eczema-asteatotic-37.jpg'],
['./erosio-interdigitalis-blastomycetica-34.jpg'],
['./herpes-simplex-55.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()