Spaces:
Sleeping
Sleeping
File size: 704 Bytes
a2841da 2eac204 e5e427f 2eac204 e5e427f 2eac204 54a5a80 77bdc64 2eac204 54a5a80 2eac204 54a5a80 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from fastai.learner import load_learner
import gradio as gr
from huggingface_hub import from_pretrained_fastai
# Carga del modelo desde HuggingFace Hub
learn = from_pretrained_fastai("ivferns/clasificador_textos")
# Función de predicción
def clasificar_texto(texto):
pred, idx, probs = learn.predict(texto)
return str(pred)
# Interfaz Gradio
iface = gr.Interface(
fn=clasificar_texto,
inputs=gr.Textbox(lines=5, label="Introduce el texto"),
outputs=gr.Label(label="Prediccion"),
title="Clasificador de textos",
description="Modelo de clasificación de textos fine-tuned con FastAI y desplegado en Hugging Face Spaces."
)
if __name__ == "__main__":
iface.launch() |