Spaces:
Runtime error
Runtime error
Karthikeyan
commited on
Commit
•
9cf1da2
1
Parent(s):
86e6738
Update app.py
Browse files
app.py
CHANGED
@@ -78,9 +78,9 @@ class SentimentAnalyzer:
|
|
78 |
end_index = sentiment_scores.find("]")
|
79 |
list1_text = sentiment_scores[start_index + 1: end_index]
|
80 |
list2_text = sentiment_scores[end_index + 2:-1]
|
81 |
-
|
82 |
scores = list(map(float, list2_text.split(",")))
|
83 |
-
score_dict={"Labels":
|
84 |
print(score_dict)
|
85 |
return score_dict
|
86 |
|
@@ -149,8 +149,8 @@ class LangChain_Document_QA:
|
|
149 |
return summary
|
150 |
|
151 |
def _display_graph(self,sentiment_scores):
|
152 |
-
|
153 |
-
fig.
|
154 |
fig.update_layout(height=500, width=200)
|
155 |
return fig
|
156 |
def _display_graph_emotion(self,customer_emotion_score):
|
|
|
78 |
end_index = sentiment_scores.find("]")
|
79 |
list1_text = sentiment_scores[start_index + 1: end_index]
|
80 |
list2_text = sentiment_scores[end_index + 2:-1]
|
81 |
+
sentiment = list(map(str.strip, list1_text.split(",")))
|
82 |
scores = list(map(float, list2_text.split(",")))
|
83 |
+
score_dict={"Labels": sentiment, "Score": scores}
|
84 |
print(score_dict)
|
85 |
return score_dict
|
86 |
|
|
|
149 |
return summary
|
150 |
|
151 |
def _display_graph(self,sentiment_scores):
|
152 |
+
df = pd.DataFrame(sentiment_scores)
|
153 |
+
fig = px.bar(df, x='Score', y='Labels', orientation='h', labels={'Score': 'Score', 'Labels': 'Sentiment'})
|
154 |
fig.update_layout(height=500, width=200)
|
155 |
return fig
|
156 |
def _display_graph_emotion(self,customer_emotion_score):
|