Spaces:
Runtime error
Runtime error
Commit
•
eba9c51
1
Parent(s):
6eddc8d
update
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ all_articles_toi = newsapi.get_everything(sources='the-times-of-india',
|
|
26 |
sort_by='relevancy',)
|
27 |
sentiment_toi = ['Negative' if classifier(entry['content'])[0]['label'] == 'LABEL_0' else 'Neutral' if classifier(entry['content'])[0]['label'] == 'LABEL_1' else 'Positive' for entry in all_articles_toi['articles']]
|
28 |
print(f"sentiment_toi length is {len(sentiment_toi)}")
|
29 |
-
print(f"all_articles_toi length is {len(all_articles_toi)}")
|
30 |
|
31 |
#the hindu
|
32 |
all_articles_hindu = newsapi.get_everything(sources='the-hindu',
|
@@ -37,7 +37,7 @@ all_articles_hindu = newsapi.get_everything(sources='the-hindu',
|
|
37 |
sort_by='relevancy',)
|
38 |
sentiment_hindu = ['Negative' if classifier(entry['content'])[0]['label'] == 'LABEL_0' else 'Neutral' if classifier(entry['content'])[0]['label'] == 'LABEL_1' else 'Positive' for entry in all_articles_hindu['articles']]
|
39 |
print(f"sentiment_hindu length is {len(sentiment_hindu)}")
|
40 |
-
print(f"all_articles_hindu length is {len(all_articles_hindu)}")
|
41 |
|
42 |
#google news
|
43 |
all_articles_google = newsapi.get_everything(sources='google-news-in',
|
@@ -48,7 +48,7 @@ all_articles_google = newsapi.get_everything(sources='google-news-in',
|
|
48 |
sort_by='relevancy',)
|
49 |
sentiment_google = ['Negative' if classifier(entry['content'])[0]['label'] == 'LABEL_0' else 'Neutral' if classifier(entry['content'])[0]['label'] == 'LABEL_1' else 'Positive' for entry in all_articles_google['articles']]
|
50 |
print(f"sentiment_google length is {len(sentiment_google)}")
|
51 |
-
print(f"all_articles_google length is {len(all_articles_google)}")
|
52 |
|
53 |
#Driver
|
54 |
def inference(newssource): #, date):
|
|
|
26 |
sort_by='relevancy',)
|
27 |
sentiment_toi = ['Negative' if classifier(entry['content'])[0]['label'] == 'LABEL_0' else 'Neutral' if classifier(entry['content'])[0]['label'] == 'LABEL_1' else 'Positive' for entry in all_articles_toi['articles']]
|
28 |
print(f"sentiment_toi length is {len(sentiment_toi)}")
|
29 |
+
print(f"all_articles_toi length is {len(all_articles_toi['articles'])}")
|
30 |
|
31 |
#the hindu
|
32 |
all_articles_hindu = newsapi.get_everything(sources='the-hindu',
|
|
|
37 |
sort_by='relevancy',)
|
38 |
sentiment_hindu = ['Negative' if classifier(entry['content'])[0]['label'] == 'LABEL_0' else 'Neutral' if classifier(entry['content'])[0]['label'] == 'LABEL_1' else 'Positive' for entry in all_articles_hindu['articles']]
|
39 |
print(f"sentiment_hindu length is {len(sentiment_hindu)}")
|
40 |
+
print(f"all_articles_hindu length is {len(all_articles_hindu['articles'])}")
|
41 |
|
42 |
#google news
|
43 |
all_articles_google = newsapi.get_everything(sources='google-news-in',
|
|
|
48 |
sort_by='relevancy',)
|
49 |
sentiment_google = ['Negative' if classifier(entry['content'])[0]['label'] == 'LABEL_0' else 'Neutral' if classifier(entry['content'])[0]['label'] == 'LABEL_1' else 'Positive' for entry in all_articles_google['articles']]
|
50 |
print(f"sentiment_google length is {len(sentiment_google)}")
|
51 |
+
print(f"all_articles_google length is {len(all_articles_google['articles'])}")
|
52 |
|
53 |
#Driver
|
54 |
def inference(newssource): #, date):
|