Spaces:
Runtime error
Runtime error
cybernatedArt
commited on
Commit
•
d7119c4
1
Parent(s):
921a918
initial commit
Browse files
app.py
CHANGED
@@ -1,30 +1,20 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
'Poison Ivy Photos and other Contact Dermatitis', 'Psoriasis pictures Lichen Planus and related diseases',
|
18 |
-
'Scabies Lyme Disease and other Infestations and Bites', 'Seborrheic Keratoses and other Benign Tumors', 'Systemic Disease',
|
19 |
-
'Tinea Ringworm Candidiasis and other Fungal Infections', 'Urticaria Hives', 'Vascular Tumors', 'Vasculitis Photos',
|
20 |
-
'Warts Molluscum and other Viral Infections']
|
21 |
-
return {class_names[i]: float(prediction[i]) for i in range(23)}
|
22 |
-
|
23 |
-
|
24 |
-
# initializing the input component
|
25 |
-
image = gr.inputs.Image(shape = (256, 256))
|
26 |
-
# initializing the output component
|
27 |
-
label = gr.outputs.Label(num_top_classes = 4)
|
28 |
|
29 |
# launching the interface
|
30 |
|
@@ -41,8 +31,11 @@ examples = [
|
|
41 |
]
|
42 |
|
43 |
# launching the interface
|
44 |
-
gr.Interface( fn=
|
|
|
|
|
|
|
45 |
title=title,
|
46 |
description= description,
|
47 |
examples = examples
|
48 |
-
).launch(share=True
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
# Cargamos el learner
|
6 |
+
learn = load_learner('Pickle_SD_Model.pkl')
|
7 |
+
|
8 |
+
# Definimos las etiquetas de nuestro modelo
|
9 |
+
labels = learn.dls.vocab
|
10 |
+
|
11 |
+
|
12 |
+
# Definimos una función que se encarga de llevar a cabo las predicciones
|
13 |
+
def predict(img):
|
14 |
+
img = PILImage.create(img)
|
15 |
+
pred,pred_idx,probs = learn.predict(img)
|
16 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
17 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
# launching the interface
|
20 |
|
|
|
31 |
]
|
32 |
|
33 |
# launching the interface
|
34 |
+
gr.Interface( fn=predict,
|
35 |
+
inputs = gr.inputs.Image(shape=(256, 256)),
|
36 |
+
outputs = gr.outputs.Label(num_top_classes=3),
|
37 |
+
capture_session = True,
|
38 |
title=title,
|
39 |
description= description,
|
40 |
examples = examples
|
41 |
+
).launch(share=True)
|