Zemog13's picture
Update app.py
8efd343 verified
raw
history blame contribute delete
530 Bytes
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):
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()