Spaces:
Runtime error
Runtime error
Karthikeyan
commited on
Commit
•
a62130b
1
Parent(s):
873cb4b
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 |
"""
|
@@ -55,16 +55,16 @@ class SentimentAnalyzer:
|
|
55 |
}
|
56 |
return sentiment_scores
|
57 |
|
58 |
-
def emotion_analysis_for_graph(self,text):
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
|
69 |
|
70 |
class Summarizer:
|
@@ -154,11 +154,12 @@ class LangChain_Document_QA:
|
|
154 |
except:
|
155 |
pass
|
156 |
|
157 |
-
prompt = f"""As an empathic AI Mental Healthcare Doctor Chatbot, provide effective solutions to patients' mental health concerns.
|
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 |
if patient say thanking tone message to end the conversation with a thanking greeting when the patient expresses gratitude.
|
161 |
Analyse the patient json If asked for information take it from {patient_details}
|
|
|
162 |
Chat History:[{history}]
|
163 |
Patient: [{text}]
|
164 |
Perform as Mental Healthcare Doctor Chatbot
|
@@ -264,7 +265,7 @@ class LangChain_Document_QA:
|
|
264 |
emptyBtn.click(self.clear_func,[],[])
|
265 |
emptyBtn.click(lambda: None, None, chatbot, queue=False)
|
266 |
|
267 |
-
Sentiment_btn.click(self._on_sentiment_btn_click,[],[txt5
|
268 |
|
269 |
demo.title = "AI Mental Healthcare ChatBot"
|
270 |
demo.launch()
|
|
|
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 3 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 format: \{emotions: scores\} [with top 3 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 |
"""
|
|
|
55 |
}
|
56 |
return sentiment_scores
|
57 |
|
58 |
+
# def emotion_analysis_for_graph(self,text):
|
59 |
|
60 |
+
# list_of_emotion=text.split(":")
|
61 |
+
# label=list_of_emotion[0]
|
62 |
+
# score=list_of_emotion[1]
|
63 |
+
# score_dict={
|
64 |
+
# label:float(score)
|
65 |
+
# }
|
66 |
+
# print(score_dict)
|
67 |
+
# return score_dict
|
68 |
|
69 |
|
70 |
class Summarizer:
|
|
|
154 |
except:
|
155 |
pass
|
156 |
|
157 |
+
prompt = f"""As an empathic AI Mental Healthcare Doctor Chatbot, provide effective solutions to patients' mental health concerns. \
|
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 |
if patient say thanking tone message to end the conversation with a thanking greeting when the patient expresses gratitude.
|
161 |
Analyse the patient json If asked for information take it from {patient_details}
|
162 |
+
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>
|
163 |
Chat History:[{history}]
|
164 |
Patient: [{text}]
|
165 |
Perform as Mental Healthcare Doctor Chatbot
|
|
|
265 |
emptyBtn.click(self.clear_func,[],[])
|
266 |
emptyBtn.click(lambda: None, None, chatbot, queue=False)
|
267 |
|
268 |
+
Sentiment_btn.click(self._on_sentiment_btn_click,[],[txt5])
|
269 |
|
270 |
demo.title = "AI Mental Healthcare ChatBot"
|
271 |
demo.launch()
|