Spaces:
Sleeping
Sleeping
model added
Browse files- app.py +31 -2
- dermatologist_fastai.pkl +3 -0
app.py
CHANGED
|
@@ -1,7 +1,36 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def greet(name):
|
| 4 |
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
|
| 4 |
+
learner = load_learner('dermatologist_fastai.pkl')
|
| 5 |
+
categories = (
|
| 6 |
+
'acne_vulgaris',
|
| 7 |
+
'actinic_keratosis',
|
| 8 |
+
'allergic_contact_dermatitis',
|
| 9 |
+
'dermatofibroma',
|
| 10 |
+
'drug_induced_pigmentary_changes',
|
| 11 |
+
'granuloma_annulare',
|
| 12 |
+
'hidradenitis',
|
| 13 |
+
'kaposi_sarcoma',
|
| 14 |
+
'melanoma',
|
| 15 |
+
'necrobiosis_lipoidica',
|
| 16 |
+
'nematode_infection',
|
| 17 |
+
'neutrophilic_dermatoses',
|
| 18 |
+
'photodermatoses',
|
| 19 |
+
'psoriasis',
|
| 20 |
+
'sarcoidosis',
|
| 21 |
+
'xeroderma_pigmentosum'
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
def predict(img):
|
| 25 |
+
preds, idx, probs = learner.predict(img)
|
| 26 |
+
return dict(zip(categories, map(float, probs)))
|
| 27 |
|
| 28 |
def greet(name):
|
| 29 |
return "Hello " + name + "!!"
|
| 30 |
|
| 31 |
+
image = gr.inputs.Image()
|
| 32 |
+
label = gr.outputs.Label()
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
demo = gr.Interface(fn=predict, inputs=image, outputs=label)
|
| 36 |
+
demo.launch(inline=False)
|
dermatologist_fastai.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e5751c152926d3d696a1943c1ceef49ea71c5011775dc04207cbb2c7b2a924d3
|
| 3 |
+
size 47097515
|