Spaces:
Runtime error
Runtime error
Karthikeyan
commited on
Commit
·
574e516
1
Parent(s):
34f02f6
Update app.py
Browse files
app.py
CHANGED
@@ -25,8 +25,8 @@ class SentimentAnalyzer:
|
|
25 |
sentiment_scores_str = f"Positive: {sentiment_scores['positive']:.2f}, Neutral: {sentiment_scores['neutral']:.2f}, Negative: {sentiment_scores['negative']:.2f}"
|
26 |
return sentiment_scores_str
|
27 |
def emotion_analysis(self,text):
|
28 |
-
prompt = f""" Your task is find the top
|
29 |
-
your are analyze the text and provide the output in the following format:
|
30 |
The scores should be in the range of 0.0 to 1.0, where 1.0 represents the highest intensity of the emotion.\
|
31 |
analyze the text : '''{text}'''
|
32 |
"""
|
@@ -154,14 +154,13 @@ class LangChain_Document_QA:
|
|
154 |
except:
|
155 |
pass
|
156 |
|
157 |
-
prompt = f"""
|
|
|
158 |
first start the conversation ask existing patient or new patient. if new patient get name,age,gender,contact,address from the patient and start.
|
159 |
if existing customer get name,age,gender,contact,address details and start the chat about existing issues and current issues.
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
Chat History:[{history}]
|
164 |
-
Patient: [{text}]
|
165 |
Perform as Mental Healthcare Doctor Chatbot
|
166 |
"""
|
167 |
response = openai.Completion.create(
|
@@ -202,7 +201,9 @@ class LangChain_Document_QA:
|
|
202 |
|
203 |
customer_emotion_fig=self._display_graph(customer_emotion_score)
|
204 |
customer_emotion_fig.update_layout(title="Emotion Analysis",width=770)
|
205 |
-
|
|
|
|
|
206 |
return scores,customer_fig,customer_emotion_fig
|
207 |
|
208 |
|
|
|
25 |
sentiment_scores_str = f"Positive: {sentiment_scores['positive']:.2f}, Neutral: {sentiment_scores['neutral']:.2f}, Negative: {sentiment_scores['negative']:.2f}"
|
26 |
return sentiment_scores_str
|
27 |
def emotion_analysis(self,text):
|
28 |
+
prompt = f""" Your task is find the top 1 emotion : <Sadness, Happiness, Joy, Fear, Disgust, Anger> and it's emotion score of the text.\
|
29 |
+
your are analyze the text and provide the output in the following dict format: '''emotions: scores''' [with top 1 result having the highest score]
|
30 |
The scores should be in the range of 0.0 to 1.0, where 1.0 represents the highest intensity of the emotion.\
|
31 |
analyze the text : '''{text}'''
|
32 |
"""
|
|
|
154 |
except:
|
155 |
pass
|
156 |
|
157 |
+
prompt = f"""Analyse the patient json If asked for information take it from {patient_details}\
|
158 |
+
you first get patient details : <get name,age,gender,contact,address from patient> if not match patient json information start new chat else match patient json information ask previous: <description,symptoms,diagnosis,treatment talk about patient>As an empathic AI Mental Healthcare Doctor Chatbot, provide effective solutions to patients' mental health concerns. \
|
159 |
first start the conversation ask existing patient or new patient. if new patient get name,age,gender,contact,address from the patient and start.
|
160 |
if existing customer get name,age,gender,contact,address details and start the chat about existing issues and current issues.
|
161 |
+
if patient say thanking tone message to end the conversation with a thanking greeting when the patient expresses gratitude.
|
162 |
+
Chat History:['''{history}''']
|
163 |
+
Patient: ['''{text}''']
|
|
|
|
|
164 |
Perform as Mental Healthcare Doctor Chatbot
|
165 |
"""
|
166 |
response = openai.Completion.create(
|
|
|
201 |
|
202 |
customer_emotion_fig=self._display_graph(customer_emotion_score)
|
203 |
customer_emotion_fig.update_layout(title="Emotion Analysis",width=770)
|
204 |
+
print("scores :{}",scores)
|
205 |
+
print("customer_fig :{}",customer_fig)
|
206 |
+
print("customer_emotion_fig :{}",customer_emotion_fig)
|
207 |
return scores,customer_fig,customer_emotion_fig
|
208 |
|
209 |
|