Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ def sentiment_analysis(text: str) -> str:
|
|
18 |
result = {
|
19 |
'polarity': round(sentiment.polarity, 2), # -1 (negative) to 1 (positive)
|
20 |
'subjectivity': round(sentiment.subjectivity, 2), # 0 (objective) to 1 (subjective)
|
21 |
-
'assessment': if sentiment.polarity > 0 else "negative" if sentiment.polarity < 0 else "neutral"
|
22 |
}
|
23 |
|
24 |
return json.dumps(result)
|
|
|
18 |
result = {
|
19 |
'polarity': round(sentiment.polarity, 2), # -1 (negative) to 1 (positive)
|
20 |
'subjectivity': round(sentiment.subjectivity, 2), # 0 (objective) to 1 (subjective)
|
21 |
+
'assessment': "positive" if sentiment.polarity > 0 else "negative" if sentiment.polarity < 0 else "neutral"
|
22 |
}
|
23 |
|
24 |
return json.dumps(result)
|