Spaces:
Sleeping
Sleeping
File size: 802 Bytes
1ee748d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import gradio as gr
from fastai.text.all import *
learn = load_learner('modelo_emociones_fastai.pkl')
categorias = learn.dls.vocab[1]
def clasificar_emocion(texto):
pred, pred_idx, probs = learn.predict(texto)
return dict(zip(categorias, map(float, probs)))
interfaz = gr.Interface(
fn=clasificar_emocion,
inputs=gr.Textbox(lines=3, placeholder="Escribe un texto en inglés aquí..."),
outputs=gr.Label(num_top_classes=3),
title="🤖 Analizador de Emociones",
description="Modelo de Deep Learning entrenado con Fastai (ULMFiT) capaz de detectar 6 emociones distintas en texto.",
examples=["I just got a promotion at work, this is amazing!", "I feel so lonely and cold today.", "Don't you dare talk to me like that!"]
)
interfaz.launch() |