Spaces:
Runtime error
Runtime error
Karthikeyan
commited on
Commit
•
34f02f6
1
Parent(s):
e92b7a3
Update app.py
Browse files
app.py
CHANGED
@@ -55,16 +55,16 @@ class SentimentAnalyzer:
|
|
55 |
}
|
56 |
return sentiment_scores
|
57 |
|
58 |
-
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
|
69 |
|
70 |
class Summarizer:
|
@@ -203,7 +203,7 @@ class LangChain_Document_QA:
|
|
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
|
207 |
|
208 |
|
209 |
def clear_func(self):
|
@@ -265,7 +265,7 @@ class LangChain_Document_QA:
|
|
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()
|
|
|
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:
|
|
|
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 |
|
209 |
def clear_func(self):
|
|
|
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,plot,plot_3])
|
269 |
|
270 |
demo.title = "AI Mental Healthcare ChatBot"
|
271 |
demo.launch()
|