Spaces:
Sleeping
Sleeping
Initial version
Browse files- app.py +13 -0
- requirements.txt +3 -0
- wna_googlenews.py +11 -0
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import wna_googlenews as wna
|
3 |
+
|
4 |
+
|
5 |
+
st.title("WNA Google News App")
|
6 |
+
st.subheader("Search for News")
|
7 |
+
|
8 |
+
query = st.text_input("Enter Query")
|
9 |
+
|
10 |
+
if st.button("Search"):
|
11 |
+
df = wna.get_news("en", "us", query)
|
12 |
+
st.dataframe(df)
|
13 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
GoogleNews
|
2 |
+
pandas
|
3 |
+
transformers
|
wna_googlenews.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from GoogleNews import GoogleNews
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
# get the news with lang and country parameters
|
6 |
+
def get_news(lang, country, query):
|
7 |
+
googlenews = GoogleNews(lang=lang, country=country)
|
8 |
+
googlenews.search(query)
|
9 |
+
result = googlenews.result()
|
10 |
+
df = pd.DataFrame(result)
|
11 |
+
return df
|