Sharpaxis commited on
Commit
5fe3439
·
verified ·
1 Parent(s): a0fa569

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -16
README.md CHANGED
@@ -95,26 +95,14 @@ def finance_sentiment_predictor(text):
95
  text = str(text)
96
  out = classifier(text)[0]
97
  scores = [sample['score'] for sample in out]
98
- labels = [sample['label'] for sample in out]
99
- label_map = {'LABEL_0': "Negative", 'LABEL_1': "Neutral", 'LABEL_2': "Positive"}
100
- sentiments = [label_map[label] for label in labels]
101
-
102
  for i in range(len(scores)):
103
  print(f"{sentiments[i]} : {scores[i]}")
104
-
105
  print(f"Sentiment of text is {sentiments[np.argmax(scores)]}")
106
-
107
- # Create the bar chart
108
  fig = go.Figure(
109
- data=[
110
- go.Bar(
111
- x=sentiments,
112
- y=scores,
113
- marker=dict(color=["red", "blue", "green"]),
114
- width=0.3 # Adjust bar width
115
- )
116
- ]
117
- )
118
  fig.update_layout(
119
  title="Sentiment Analysis Scores",
120
  xaxis_title="Sentiments",
 
95
  text = str(text)
96
  out = classifier(text)[0]
97
  scores = [sample['score'] for sample in out]
98
+ labels = [sample['label'] for sample in out ]
99
+ label_map = {'LABEL_0':"Negative",'LABEL_1':"Neutral",'LABEL_2':"Positive"}
100
+ sentiments = [label_map[label] for label in labels]
 
101
  for i in range(len(scores)):
102
  print(f"{sentiments[i]} : {scores[i]}")
 
103
  print(f"Sentiment of text is {sentiments[np.argmax(scores)]}")
 
 
104
  fig = go.Figure(
105
+ data=[go.Bar(x=sentiments,y=scores,marker=dict(color=["red", "blue", "green"]),width=0.3)])
 
 
 
 
 
 
 
 
106
  fig.update_layout(
107
  title="Sentiment Analysis Scores",
108
  xaxis_title="Sentiments",