Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -23,19 +23,26 @@ class ADA_SKIN(object):
|
|
23 |
self._pp("Author is", self.author)
|
24 |
self._ph()
|
25 |
#
|
26 |
-
self.article = '<div><h3>
|
|
|
|
|
|
|
27 |
self.article += 'Author/Dev: Duc Haba, 2022.</li>'
|
28 |
self.article += '<li><a target="_blank" href="https://linkedin.com/in/duchaba">https://linkedin.com/in/duchaba</a></li>'
|
29 |
-
self.article += '<li>The training dataset the
|
|
|
30 |
self.article += '<ol>'
|
31 |
self.article += '<li>https://www.kaggle.com/datasets/surajghuwalewala/ham1000-segmentation-and-classification</li>'
|
32 |
self.article += '<li>https://www.kaggle.com/datasets/andrewmvd/isic-2019</li>'
|
33 |
self.article += '<li>https://www.kaggle.com/datasets/jnegrini/skin-lesions-act-keratosis-and-melanoma</li>'
|
|
|
|
|
|
|
34 |
self.article += '</ol></ul>'
|
35 |
self.article += '<h3>Articles:</h3><ul>'
|
36 |
-
self.article += '<li><a target="_blank" href="https://
|
37 |
self.article += '"Skin Cancer Diagnose"</a> on LinkedIn, on <a target="_blank" href='
|
38 |
-
self.article += '"https://
|
39 |
self.article += '</ul>'
|
40 |
self.article += '<h3>Example Images: (left to right)</h3><ol>'
|
41 |
self.article += '<li>Bowen Disease (AKIEC)</li>'
|
@@ -59,7 +66,7 @@ class ADA_SKIN(object):
|
|
59 |
self.article += '<li>Fast.ai, PyTorch</li>'
|
60 |
self.article += '</ul>'
|
61 |
self.article += '<h3>Licenses:</h3><ul>'
|
62 |
-
self.article += '<li
|
63 |
self.article += '</ul></div>'
|
64 |
self.examples = ['akiec1.jpg','bcc1.jpg','bkl1.jpg','df1.jpg','mel1.jpg',
|
65 |
'nevi1.jpg','scc1.jpg','vl1.jpg','benign1.jpg','benign3.jpg']
|
@@ -86,8 +93,8 @@ class ADA_SKIN(object):
|
|
86 |
#
|
87 |
def _draw_pred(self,df_pred, df2):
|
88 |
canvas, pic = matplotlib.pyplot.subplots(1,2, figsize=(12,6))
|
89 |
-
ti = df_pred["
|
90 |
-
ti2 = df2["
|
91 |
# special case
|
92 |
#if (matplotlib.__version__) >= "3.5.2":
|
93 |
try:
|
@@ -137,14 +144,13 @@ class ADA_SKIN(object):
|
|
137 |
d = self._predict_image(img,self.categories)
|
138 |
df = pandas.DataFrame(d, index=[0])
|
139 |
df = df.transpose().reset_index()
|
140 |
-
df.columns = ["
|
141 |
df.sort_values("pred", inplace=True,ascending=False, ignore_index=True)
|
142 |
#
|
143 |
d2 = self._predict_image2(img,self.categories2)
|
144 |
df2 = pandas.DataFrame(d2, index=[0])
|
145 |
df2 = df2.transpose().reset_index()
|
146 |
-
df2.columns = ["
|
147 |
-
#df2.sort_values("pred", inplace=True,ascending=False, ignore_index=True)
|
148 |
#
|
149 |
canvas = self._draw_pred(df,df2)
|
150 |
return canvas
|
|
|
23 |
self._pp("Author is", self.author)
|
24 |
self._ph()
|
25 |
#
|
26 |
+
self.article = '<div><h3>Warning:</h3>Do NOT use this for any medical diagnosis.<br>'
|
27 |
+
self.article += 'I am not a dermatologist, and NO dermatologist has endorsed it. '
|
28 |
+
self.article += 'This DL model is for my independent research. <br>Please refer to the GPL 3.0 for usage and license.'
|
29 |
+
self.article += '<h3>Citation:</h3><ul><li>'
|
30 |
self.article += 'Author/Dev: Duc Haba, 2022.</li>'
|
31 |
self.article += '<li><a target="_blank" href="https://linkedin.com/in/duchaba">https://linkedin.com/in/duchaba</a></li>'
|
32 |
+
self.article += '<li>The training dataset are from the International Skin Imaging Collaboration (ISIC)</li>'
|
33 |
+
self.article += '<li>The Skin Cancer Identification are from 3 seperate datasets.</li>'
|
34 |
self.article += '<ol>'
|
35 |
self.article += '<li>https://www.kaggle.com/datasets/surajghuwalewala/ham1000-segmentation-and-classification</li>'
|
36 |
self.article += '<li>https://www.kaggle.com/datasets/andrewmvd/isic-2019</li>'
|
37 |
self.article += '<li>https://www.kaggle.com/datasets/jnegrini/skin-lesions-act-keratosis-and-melanoma</li>'
|
38 |
+
self.article += '<ul><li>'
|
39 |
+
self.article += 'The Malignant versus Benign dataset</li>'
|
40 |
+
self.article += '<ol><li>https://www.kaggle.com/datasets/fanconic/skin-cancer-malignant-vs-benign</li>'
|
41 |
self.article += '</ol></ul>'
|
42 |
self.article += '<h3>Articles:</h3><ul>'
|
43 |
+
self.article += '<li><a target="_blank" href="https://huggingface.co/spaces/duchaba/skin_cancer_diagnose">'
|
44 |
self.article += '"Skin Cancer Diagnose"</a> on LinkedIn, on <a target="_blank" href='
|
45 |
+
self.article += '"https://huggingface.co/spaces/duchaba/skin_cancer_diagnose">Medium.</a></li>'
|
46 |
self.article += '</ul>'
|
47 |
self.article += '<h3>Example Images: (left to right)</h3><ol>'
|
48 |
self.article += '<li>Bowen Disease (AKIEC)</li>'
|
|
|
66 |
self.article += '<li>Fast.ai, PyTorch</li>'
|
67 |
self.article += '</ul>'
|
68 |
self.article += '<h3>Licenses:</h3><ul>'
|
69 |
+
self.article += '<li><a target="_blank" href="https://www.gnu.org/licenses/gpl-3.0.txt">GNU GPL 3.0</a></li>'
|
70 |
self.article += '</ul></div>'
|
71 |
self.examples = ['akiec1.jpg','bcc1.jpg','bkl1.jpg','df1.jpg','mel1.jpg',
|
72 |
'nevi1.jpg','scc1.jpg','vl1.jpg','benign1.jpg','benign3.jpg']
|
|
|
93 |
#
|
94 |
def _draw_pred(self,df_pred, df2):
|
95 |
canvas, pic = matplotlib.pyplot.subplots(1,2, figsize=(12,6))
|
96 |
+
ti = df_pred["vocab"].head(3).values
|
97 |
+
ti2 = df2["vocab"].head(2).values
|
98 |
# special case
|
99 |
#if (matplotlib.__version__) >= "3.5.2":
|
100 |
try:
|
|
|
144 |
d = self._predict_image(img,self.categories)
|
145 |
df = pandas.DataFrame(d, index=[0])
|
146 |
df = df.transpose().reset_index()
|
147 |
+
df.columns = ["vocab", "pred"]
|
148 |
df.sort_values("pred", inplace=True,ascending=False, ignore_index=True)
|
149 |
#
|
150 |
d2 = self._predict_image2(img,self.categories2)
|
151 |
df2 = pandas.DataFrame(d2, index=[0])
|
152 |
df2 = df2.transpose().reset_index()
|
153 |
+
df2.columns = ["vocab", "pred"]
|
|
|
154 |
#
|
155 |
canvas = self._draw_pred(df,df2)
|
156 |
return canvas
|