Spaces:
Runtime error
Runtime error
Commit
·
85b5803
1
Parent(s):
b510a14
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def article_selection(sentiment):
|
|
27 |
if sentiment == "Positive":
|
28 |
predictions = positive_preds
|
29 |
predictions_shuffled = predictions.sample(frac=1,weights=predictions['Confidence'])
|
30 |
-
top3 =
|
31 |
top3_result = top3[['Headline_string','Url']]
|
32 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
33 |
return top3_result
|
@@ -35,14 +35,14 @@ def article_selection(sentiment):
|
|
35 |
elif sentiment == "Negative":
|
36 |
predictions = negative_preds
|
37 |
predictions_shuffled = predictions.sample(frac=1,weights=predictions['Confidence'])
|
38 |
-
top3 =
|
39 |
top3_result = top3[['Headline_string','Url']]
|
40 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
41 |
return top3_result
|
42 |
else:
|
43 |
predictions = neutral_preds
|
44 |
predictions_shuffled = predictions.sample(frac=1,weights=predictions['Confidence'])
|
45 |
-
top3 =
|
46 |
top3_result = top3[['Headline_string','Url']]
|
47 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
48 |
return top3_result
|
|
|
27 |
if sentiment == "Positive":
|
28 |
predictions = positive_preds
|
29 |
predictions_shuffled = predictions.sample(frac=1,weights=predictions['Confidence'])
|
30 |
+
top3 = predictions_shuffled[0:n]
|
31 |
top3_result = top3[['Headline_string','Url']]
|
32 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
33 |
return top3_result
|
|
|
35 |
elif sentiment == "Negative":
|
36 |
predictions = negative_preds
|
37 |
predictions_shuffled = predictions.sample(frac=1,weights=predictions['Confidence'])
|
38 |
+
top3 = predictions_shuffled[0:n]
|
39 |
top3_result = top3[['Headline_string','Url']]
|
40 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
41 |
return top3_result
|
42 |
else:
|
43 |
predictions = neutral_preds
|
44 |
predictions_shuffled = predictions.sample(frac=1,weights=predictions['Confidence'])
|
45 |
+
top3 = predictions_shuffled[0:n]
|
46 |
top3_result = top3[['Headline_string','Url']]
|
47 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
48 |
return top3_result
|