Spaces:
Sleeping
Sleeping
File size: 534 Bytes
39494ee 91554b5 39494ee 91554b5 39494ee 91554b5 39494ee 91554b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import gradio as gr
from fastai.vision.core import PILImage
from huggingface_hub import from_pretrained_fastai
# Cargar directamente desde el repositorio en Hugging Face
learn = from_pretrained_fastai("jeancguerrero/fastai-simple-climate") # o el nombre que corresponda
def predict(img):
pred_class, pred_idx, probs = learn.predict(PILImage.create(img))
return f"Clase Predicha: {pred_class}, Probabilidad: {probs[pred_idx]:.4f}"
demo = gr.Interface(fn=predict, inputs=gr.Image(type="pil"), outputs="text")
demo.launch()
|