Spaces:
Sleeping
Sleeping
File size: 584 Bytes
78f58c6 7640354 78f58c6 8448fd3 78f58c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastai.vision.all import load_learner
from huggingface_hub import hf_hub_download
import gradio as gr
# Descarga el modelo desde Hugging Face
model_path = hf_hub_download(repo_id="Zemog13/gradio-test", filename="model.pkl")
learn = load_learner(model_path)
# Funci贸n para predicci贸n
def predict(image):
# Realiza la predicci贸n usando el modelo cargado
pred, _, probs = learn.predict(image)
return {learn.dls.vocab[i]: float(probs[i]) for i in range(len(probs))}
# Interfaz de Gradio
demo = gr.Interface(fn=predict, inputs="image", outputs="label")
demo.launch() |