Spaces:
Runtime error
Runtime error
cybernatedArt
commited on
Commit
•
08f8648
1
Parent(s):
161b27e
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import tensorflow as tf
|
3 |
+
|
4 |
+
path_to_model = "./skin_9_84.23.h5"
|
5 |
+
|
6 |
+
model = tf.keras.models.load_model(path_to_model)
|
7 |
+
|
8 |
+
labels = ['Actinic Keratosis Basal Cell', 'Atopic Dermatitis Photos', 'Eczema', 'Melanoma', 'Nail Fungus','Psoriasis','Seborrheic Keratoses', 'Tinea Ringworm', 'Warts Molluscum']
|
9 |
+
|
10 |
+
def classify_image(photos):
|
11 |
+
photos = photos.reshape((-1, 224, 224, 3))
|
12 |
+
prediction = model.predict(photos).flatten()
|
13 |
+
confidences = {labels[i]: float(prediction[i]) for i in range(23)}
|
14 |
+
return confidences
|
15 |
+
|
16 |
+
|
17 |
+
title="SKIN DISEASE PREDICTION"
|
18 |
+
|
19 |
+
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."
|
20 |
+
|
21 |
+
|
22 |
+
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"
|
23 |
+
|
24 |
+
|
25 |
+
examples = [
|
26 |
+
['./actinic-cheilitis-sq-cell-lip-47.jpg'],
|
27 |
+
['./atypical-nevi-25.jpg'],
|
28 |
+
['./eczema-asteatotic-37.jpg'],
|
29 |
+
['./erosio-interdigitalis-blastomycetica-34.jpg'],
|
30 |
+
['./herpes-simplex-55.jpg']
|
31 |
+
]
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
gr.Interface(fn=classify_image,
|
38 |
+
title = title,
|
39 |
+
article = article,
|
40 |
+
description = description,
|
41 |
+
inputs=gr.inputs.Image(shape=(224, 224)),
|
42 |
+
outputs=gr.outputs.Label(num_top_classes=4),
|
43 |
+
examples=examples).launch()
|