Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Cargar el modelo entrenado
|
| 5 |
-
learn = load_learner(
|
| 6 |
|
| 7 |
# Funci贸n para hacer predicciones
|
| 8 |
def predict(image):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import *
|
| 3 |
+
import os
|
| 4 |
+
from huggingface_hub import hf_hub_download
|
| 5 |
+
|
| 6 |
+
# Definir el repositorio y el nombre del modelo
|
| 7 |
+
repo_id = "mohadrk/Practica1"
|
| 8 |
+
model_filename = "model.pkl"
|
| 9 |
+
|
| 10 |
+
# Descargar el modelo si no existe en el entorno
|
| 11 |
+
model_path = hf_hub_download(repo_id=repo_id, filename=model_filename)
|
| 12 |
|
| 13 |
# Cargar el modelo entrenado
|
| 14 |
+
learn = load_learner(model_path)
|
| 15 |
|
| 16 |
# Funci贸n para hacer predicciones
|
| 17 |
def predict(image):
|