Karthikeyan commited on
Commit
80335f6
1 Parent(s): d831be2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -26,7 +26,7 @@ class SentimentAnalyzer:
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 list format heigher to lower order: [emotion1,emotion2,emotion3][score1,score2,score3]''' [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
  """
@@ -113,7 +113,7 @@ class LangChain_Document_QA:
113
  customer_text, agent_text = entry
114
  formatted_history += f"Patient: {customer_text}\n"
115
  if agent_text:
116
- formatted_history += f"Psycotherapist Bot: {agent_text}\n"
117
  return formatted_history
118
 
119
  def _display_history(self):
@@ -129,7 +129,7 @@ class LangChain_Document_QA:
129
  fig.update_layout(height=500, width=200)
130
  return fig
131
  def _display_graph_emotion(self,customer_emotion_score):
132
- fig = px.pie(data, values='Score', names='Emotion', title='Emotion Distribution', hover_data=['Score'])
133
  fig.update_traces(texttemplate='Emotion', textposition='outside')
134
  fig.update_layout(height=500, width=200)
135
  return fig
@@ -205,9 +205,9 @@ class LangChain_Document_QA:
205
 
206
  customer_emotion_fig=self._display_graph_emotion(customer_emotion_score)
207
  customer_emotion_fig.update_layout(title="Emotion Analysis",width=770)
208
- print("scores :{}",scores)
209
- print("customer_fig :{}",customer_fig)
210
- print("customer_emotion_fig :{}",customer_emotion_fig)
211
  return scores,customer_fig,customer_emotion_fig
212
 
213
 
 
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 list format heigher to lower order: ["emotion1","emotion2","emotion3"][score1,score2,score3]''' [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
  """
 
113
  customer_text, agent_text = entry
114
  formatted_history += f"Patient: {customer_text}\n"
115
  if agent_text:
116
+ formatted_history += f"Mental Healthcare Doctor Chatbot: {agent_text}\n"
117
  return formatted_history
118
 
119
  def _display_history(self):
 
129
  fig.update_layout(height=500, width=200)
130
  return fig
131
  def _display_graph_emotion(self,customer_emotion_score):
132
+ fig = px.pie(customer_emotion_score, values='Score', names='Emotion', title='Emotion Distribution', hover_data=['Score'])
133
  fig.update_traces(texttemplate='Emotion', textposition='outside')
134
  fig.update_layout(height=500, width=200)
135
  return fig
 
205
 
206
  customer_emotion_fig=self._display_graph_emotion(customer_emotion_score)
207
  customer_emotion_fig.update_layout(title="Emotion Analysis",width=770)
208
+ print("scores :",scores)
209
+ print("customer_fig :",customer_fig)
210
+ print("customer_emotion_fig :",customer_emotion_fig)
211
  return scores,customer_fig,customer_emotion_fig
212
 
213