Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,10 +2,10 @@ from fastai.vision.all import *
|
|
2 |
import gradio as gr
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
|
5 |
-
# Descargar el modelo exportado desde
|
6 |
-
model_path = hf_hub_download(repo_id="AdrianRevi/Practica1Blindness", filename="
|
7 |
|
8 |
-
# Cargar el modelo
|
9 |
learn = load_learner(model_path)
|
10 |
|
11 |
# Función de predicción
|
@@ -13,14 +13,14 @@ def predict(img):
|
|
13 |
pred_class, pred_idx, probs = learn.predict(img)
|
14 |
return dict(zip(learn.dls.vocab, map(float, probs)))
|
15 |
|
16 |
-
# Crear interfaz
|
17 |
demo = gr.Interface(
|
18 |
fn=predict,
|
19 |
inputs=gr.Image(type="pil"),
|
20 |
outputs=gr.Label(num_top_classes=3),
|
21 |
title="Clasificador de Ceguera",
|
22 |
description="Sube una imagen de retina para predecir el grado de ceguera.",
|
23 |
-
examples=["20068.jpg", "20084.jpg"] # Asegúrate de subir estas imágenes
|
24 |
)
|
25 |
|
26 |
if __name__ == "__main__":
|
|
|
2 |
import gradio as gr
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
|
5 |
+
# Descargar el modelo exportado desde Hugging Face
|
6 |
+
model_path = hf_hub_download(repo_id="AdrianRevi/Practica1Blindness", filename="export.pkl")
|
7 |
|
8 |
+
# Cargar el modelo localmente
|
9 |
learn = load_learner(model_path)
|
10 |
|
11 |
# Función de predicción
|
|
|
13 |
pred_class, pred_idx, probs = learn.predict(img)
|
14 |
return dict(zip(learn.dls.vocab, map(float, probs)))
|
15 |
|
16 |
+
# Crear la interfaz de Gradio
|
17 |
demo = gr.Interface(
|
18 |
fn=predict,
|
19 |
inputs=gr.Image(type="pil"),
|
20 |
outputs=gr.Label(num_top_classes=3),
|
21 |
title="Clasificador de Ceguera",
|
22 |
description="Sube una imagen de retina para predecir el grado de ceguera.",
|
23 |
+
examples=["20068.jpg", "20084.jpg"] # Asegúrate de subir estas imágenes también
|
24 |
)
|
25 |
|
26 |
if __name__ == "__main__":
|