Karthikeyan commited on
Commit
9cf1da2
1 Parent(s): 86e6738

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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
- emotions = list(map(str.strip, list1_text.split(",")))
82
  scores = list(map(float, list2_text.split(",")))
83
- score_dict={"Labels": emotions, "Score": scores}
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
- fig = px.bar(sentiment_scores, orientation='h')
153
- fig.update_traces(texttemplate='%{x:.2f}%', textposition='outside')
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):