Spaces:
Runtime error
Runtime error
Karthikeyan
commited on
Commit
•
97ce432
1
Parent(s):
0f5cd4b
Update app.py
Browse files
app.py
CHANGED
@@ -58,16 +58,8 @@ class SentimentAnalyzer:
|
|
58 |
return message
|
59 |
|
60 |
def analyze_sentiment_for_graph(self, text):
|
61 |
-
# pipe = pipeline("zero-shot-classification", model=self.model)
|
62 |
-
# label=["positive", "negative", "neutral"]
|
63 |
-
# result = pipe(text, label)
|
64 |
-
# sentiment_scores = {
|
65 |
-
# result['labels'][0]: result['scores'][0],
|
66 |
-
# result['labels'][1]: result['scores'][1],
|
67 |
-
# result['labels'][2]: result['scores'][2]
|
68 |
-
# }
|
69 |
prompt = f""" Your task is find the top 3 setiments : <labels = positive, negative, neutral> and it's sentiment score for the Mental Healthcare Doctor Chatbot and patient conversation text.\
|
70 |
-
your are analyze the text and provide the output in the following json format heigher to lower order: \"\"\"<label1: score1,
|
71 |
analyze the text : '''{text}'''
|
72 |
"""
|
73 |
response = openai.Completion.create(
|
@@ -81,7 +73,8 @@ class SentimentAnalyzer:
|
|
81 |
)
|
82 |
|
83 |
# Extract the generated text
|
84 |
-
|
|
|
85 |
print(sentiment_scores)
|
86 |
return sentiment_scores
|
87 |
|
|
|
58 |
return message
|
59 |
|
60 |
def analyze_sentiment_for_graph(self, text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
prompt = f""" Your task is find the top 3 setiments : <labels = positive, negative, neutral> and it's sentiment score for the Mental Healthcare Doctor Chatbot and patient conversation text.\
|
62 |
+
your are analyze the text and provide the output in the following json format heigher to lower order: \"\"\"<"label1": score1,"label2":score2,"label3":score3>\"\"\" \
|
63 |
analyze the text : '''{text}'''
|
64 |
"""
|
65 |
response = openai.Completion.create(
|
|
|
73 |
)
|
74 |
|
75 |
# Extract the generated text
|
76 |
+
sentiment_scores_list = response.choices[0].text.strip()
|
77 |
+
sentiment_scores={sentiment_scores_list}
|
78 |
print(sentiment_scores)
|
79 |
return sentiment_scores
|
80 |
|