Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # Carga el pipeline desde el modelo afinado | |
| clf = pipeline("text-classification", model="RodrigoGariv/sentiment-analysis-demo") | |
| def analizar_sentimiento(texto): | |
| resultado = clf(texto)[0] | |
| etiqueta = resultado['label'] | |
| puntuacion = resultado['score'] | |
| return f"Etiqueta: {etiqueta}, Confianza: {puntuacion:.2f}" | |
| interfaz = gr.Interface(fn=analizar_sentimiento, | |
| inputs=gr.Textbox(label="Texto de entrada"), | |
| outputs=gr.Textbox(label="Resultado del análisis"), | |
| title="Análisis de Sentimientos") | |
| interfaz.launch() | |