Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Cargar el modelo | |
| classifier = pipeline("text-classification", model="hafsa101010/clasificador-tweets-sentiment") | |
| # Definir la interfaz | |
| def classify_sentiment(text): | |
| result = classifier(text)[0] | |
| label_map = { | |
| "LABEL_0": "negative", | |
| "LABEL_1": "neutral", | |
| "LABEL_2": "positive" | |
| } | |
| return f"{label_map.get(result['label'], result['label'])} ({round(result['score']*100, 2)}%)" | |
| demo = gr.Interface(fn=classify_sentiment, inputs="text", outputs="text", title="Clasificador de Sentimientos en Tweets") | |
| demo.launch() |