Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,13 @@ model_name = 'pysentimiento/robertuito-sentiment-analysis'
|
|
| 7 |
classifier = pipeline("text-classification", model=model_name)
|
| 8 |
|
| 9 |
def classify_text(text):
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Create Gradio Interface
|
| 13 |
input_text = gr.inputs.Textbox(label="Texto a clasificar")
|
|
@@ -17,4 +23,4 @@ gr.Interface(fn=classify_text, inputs=input_text, outputs=output_text, examples=
|
|
| 17 |
['Estoy feliz 🤗 de mostrarles un toolkit para Análisis de Sentimientos y otras tareas de SocialNLP'],
|
| 18 |
['Espero que no lo odien.'],
|
| 19 |
['Lo odiamos.']
|
| 20 |
-
]).launch()
|
|
|
|
| 7 |
classifier = pipeline("text-classification", model=model_name)
|
| 8 |
|
| 9 |
def classify_text(text):
|
| 10 |
+
result = classifier(text)[0]['label']
|
| 11 |
+
if result == "POS":
|
| 12 |
+
return "Positivo"
|
| 13 |
+
elif result == "NEG":
|
| 14 |
+
return "Negativo"
|
| 15 |
+
else:
|
| 16 |
+
return "Neutro"
|
| 17 |
|
| 18 |
# Create Gradio Interface
|
| 19 |
input_text = gr.inputs.Textbox(label="Texto a clasificar")
|
|
|
|
| 23 |
['Estoy feliz 🤗 de mostrarles un toolkit para Análisis de Sentimientos y otras tareas de SocialNLP'],
|
| 24 |
['Espero que no lo odien.'],
|
| 25 |
['Lo odiamos.']
|
| 26 |
+
]).launch()
|