Spaces:
Sleeping
Sleeping
Yuvraj Singh commited on
Update vocca_ai/sentiment.py
Browse files- vocca_ai/sentiment.py +4 -4
vocca_ai/sentiment.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
|
| 3 |
-
#
|
| 4 |
sentiment_model = pipeline("sentiment-analysis", model="cardiffnlp/twitter-xlm-roberta-base-sentiment")
|
| 5 |
|
| 6 |
def analyze_sentiment(text):
|
|
@@ -12,10 +12,10 @@ def analyze_sentiment(text):
|
|
| 12 |
if result.lower() == "positive":
|
| 13 |
return "Positive"
|
| 14 |
elif result.lower() == "negative":
|
| 15 |
-
return "Concerned"
|
| 16 |
return "Neutral"
|
| 17 |
|
| 18 |
-
|
| 19 |
if __name__ == "__main__":
|
| 20 |
-
sample_text = "I've been feeling really weak
|
| 21 |
print(f"Sentiment: {analyze_sentiment(sample_text)}")
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
|
| 3 |
+
# Loading a sentiment model
|
| 4 |
sentiment_model = pipeline("sentiment-analysis", model="cardiffnlp/twitter-xlm-roberta-base-sentiment")
|
| 5 |
|
| 6 |
def analyze_sentiment(text):
|
|
|
|
| 12 |
if result.lower() == "positive":
|
| 13 |
return "Positive"
|
| 14 |
elif result.lower() == "negative":
|
| 15 |
+
return "Concerned"
|
| 16 |
return "Neutral"
|
| 17 |
|
| 18 |
+
|
| 19 |
if __name__ == "__main__":
|
| 20 |
+
sample_text = "I've been feeling really weak for the past few days."
|
| 21 |
print(f"Sentiment: {analyze_sentiment(sample_text)}")
|