Spaces:
Sleeping
Sleeping
Commit
•
7d583a0
1
Parent(s):
5e57339
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,9 @@ classifier = pipeline(task="zero-shot-classification", model="facebook/bart-larg
|
|
7 |
|
8 |
# Función para analizar los sentimientos de una lista de textos
|
9 |
def analyze_sentiments(texts):
|
|
|
|
|
|
|
10 |
positive, negative, neutral = 0, 0, 0
|
11 |
for text in texts:
|
12 |
results = classifier(text, ["positive", "negative", "neutral"], multi_label=True)
|
@@ -51,4 +54,4 @@ demo = gr.Interface(
|
|
51 |
description="Porcentaje de comentarios positivos, negativos y neutrales"
|
52 |
)
|
53 |
|
54 |
-
demo.launch()
|
|
|
7 |
|
8 |
# Función para analizar los sentimientos de una lista de textos
|
9 |
def analyze_sentiments(texts):
|
10 |
+
if not texts:
|
11 |
+
return 0.0, 0.0, 0.0 # Manejar el caso donde no hay textos para analizar
|
12 |
+
|
13 |
positive, negative, neutral = 0, 0, 0
|
14 |
for text in texts:
|
15 |
results = classifier(text, ["positive", "negative", "neutral"], multi_label=True)
|
|
|
54 |
description="Porcentaje de comentarios positivos, negativos y neutrales"
|
55 |
)
|
56 |
|
57 |
+
demo.launch()
|