Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,13 @@ def get_sentiment(out):
|
|
9 |
print(k)
|
10 |
label = k['label']
|
11 |
score = k['score']
|
12 |
-
d[label] = score
|
13 |
|
14 |
winning_lab = max(d.items(), key=operator.itemgetter(1))[0]
|
15 |
winning_score = d[winning_lab]
|
16 |
|
17 |
df = pd.DataFrame.from_dict(d, orient = 'index')
|
|
|
18 |
return df #winning_lab, winning_score
|
19 |
|
20 |
model_name = "mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis"
|
|
|
9 |
print(k)
|
10 |
label = k['label']
|
11 |
score = k['score']
|
12 |
+
d[label] = score
|
13 |
|
14 |
winning_lab = max(d.items(), key=operator.itemgetter(1))[0]
|
15 |
winning_score = d[winning_lab]
|
16 |
|
17 |
df = pd.DataFrame.from_dict(d, orient = 'index')
|
18 |
+
df = df.reset_index().rename(columns={'index': 'sentiment', 0:'score'})
|
19 |
return df #winning_lab, winning_score
|
20 |
|
21 |
model_name = "mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis"
|