Spaces:
Runtime error
Runtime error
Commit
·
ac12bb2
1
Parent(s):
12c27ac
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
|
|
2 |
from datasets import load_dataset
|
3 |
import pandas as pd
|
4 |
from huggingface_hub import create_repo
|
|
|
|
|
5 |
|
6 |
dataset = load_dataset("torileatherman/sentiment_analysis_batch_predictions", split='train')
|
7 |
predictions_df = pd.DataFrame(dataset)
|
@@ -15,7 +17,7 @@ predictions_df['Prediction'] = predictions_df['Prediction'].map({0: 'Negative',
|
|
15 |
|
16 |
def article_selection(sentiment):
|
17 |
if sentiment == "Positive":
|
18 |
-
predictions =
|
19 |
top3 = predictions[0:3]
|
20 |
top3_result = top3[['Headline_string','Url']]
|
21 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
@@ -28,7 +30,7 @@ def article_selection(sentiment):
|
|
28 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
29 |
return top3_result
|
30 |
else:
|
31 |
-
predictions =
|
32 |
top3 = predictions[0:3]
|
33 |
top3_result = top3[['Headline_string','Url']]
|
34 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
|
|
2 |
from datasets import load_dataset
|
3 |
import pandas as pd
|
4 |
from huggingface_hub import create_repo
|
5 |
+
from huggingface_hub import login
|
6 |
+
login()
|
7 |
|
8 |
dataset = load_dataset("torileatherman/sentiment_analysis_batch_predictions", split='train')
|
9 |
predictions_df = pd.DataFrame(dataset)
|
|
|
17 |
|
18 |
def article_selection(sentiment):
|
19 |
if sentiment == "Positive":
|
20 |
+
predictions = positive_preds
|
21 |
top3 = predictions[0:3]
|
22 |
top3_result = top3[['Headline_string','Url']]
|
23 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
|
|
30 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|
31 |
return top3_result
|
32 |
else:
|
33 |
+
predictions = neutral_preds
|
34 |
top3 = predictions[0:3]
|
35 |
top3_result = top3[['Headline_string','Url']]
|
36 |
top3_result.rename(columns = {'Headline_string':'Headlines', 'Url':'URL'})
|