Spaces:
Runtime error
Runtime error
File size: 562 Bytes
f34c5f4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from transformers import pipeline
nlp = pipeline("sentiment-analysis")
def predict_and_strategy(text):
result = nlp(text)
sentiment = result[0]['label']
# Provide strategy based on sentiment
if sentiment == "POSITIVE":
strategy = "Engage with these customers to make them brand ambassadors."
elif sentiment == "NEUTRAL":
strategy = "Try to find out what's missing and engage more with these customers."
else:
strategy = "Address the concerns of these customers immediately."
return sentiment, strategy
|