Commit
·
1e48c30
1
Parent(s):
dba06a0
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ st.set_page_config(
|
|
13 |
## FUNCTIONS ##
|
14 |
|
15 |
# search medium urls function #
|
16 |
-
@st.
|
17 |
def search_meduim_urls(monitored_tickers):
|
18 |
search_url = "https://medium.com/tag/{}".format(monitored_tickers)
|
19 |
r = requests.get(search_url)
|
@@ -24,7 +24,7 @@ def search_meduim_urls(monitored_tickers):
|
|
24 |
return hrefs
|
25 |
|
26 |
# funtion to search and scrape cleaned urls #
|
27 |
-
@st.
|
28 |
def scrape_and_process(URLs):
|
29 |
"""
|
30 |
- function grabs all p-tags.
|
@@ -46,7 +46,7 @@ def scrape_and_process(URLs):
|
|
46 |
return ARTICLES
|
47 |
|
48 |
#function to Summarise all Articles#
|
49 |
-
@st.
|
50 |
def summarize(articles,_tokenizer,_model):
|
51 |
"""
|
52 |
encode , generate, decode, append to list
|
@@ -60,7 +60,7 @@ def summarize(articles,_tokenizer,_model):
|
|
60 |
return summaries
|
61 |
|
62 |
# function to load the transformer #
|
63 |
-
@st.
|
64 |
def load_summary_transformer():
|
65 |
# load transformers #
|
66 |
model_name = "facebook/bart-large-cnn"
|
@@ -70,7 +70,7 @@ def load_summary_transformer():
|
|
70 |
return tokenizer_summary, model_summary
|
71 |
|
72 |
# function to load sentiment pipeline #
|
73 |
-
@st.
|
74 |
def load_sentiment_pipeline():
|
75 |
sentiment = pipeline('sentiment-analysis')
|
76 |
|
@@ -106,6 +106,7 @@ def cards(title,score,sentiment,article,link):
|
|
106 |
"""
|
107 |
|
108 |
# function to load bootstrap #
|
|
|
109 |
def boot():
|
110 |
return """
|
111 |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
|
|
13 |
## FUNCTIONS ##
|
14 |
|
15 |
# search medium urls function #
|
16 |
+
@st.experimental_singleton
|
17 |
def search_meduim_urls(monitored_tickers):
|
18 |
search_url = "https://medium.com/tag/{}".format(monitored_tickers)
|
19 |
r = requests.get(search_url)
|
|
|
24 |
return hrefs
|
25 |
|
26 |
# funtion to search and scrape cleaned urls #
|
27 |
+
@st.experimental_singleton
|
28 |
def scrape_and_process(URLs):
|
29 |
"""
|
30 |
- function grabs all p-tags.
|
|
|
46 |
return ARTICLES
|
47 |
|
48 |
#function to Summarise all Articles#
|
49 |
+
@st.experimental_singleton
|
50 |
def summarize(articles,_tokenizer,_model):
|
51 |
"""
|
52 |
encode , generate, decode, append to list
|
|
|
60 |
return summaries
|
61 |
|
62 |
# function to load the transformer #
|
63 |
+
@st.experimental_singleton
|
64 |
def load_summary_transformer():
|
65 |
# load transformers #
|
66 |
model_name = "facebook/bart-large-cnn"
|
|
|
70 |
return tokenizer_summary, model_summary
|
71 |
|
72 |
# function to load sentiment pipeline #
|
73 |
+
@st.experimental_singleton
|
74 |
def load_sentiment_pipeline():
|
75 |
sentiment = pipeline('sentiment-analysis')
|
76 |
|
|
|
106 |
"""
|
107 |
|
108 |
# function to load bootstrap #
|
109 |
+
@st.experimental_singleton
|
110 |
def boot():
|
111 |
return """
|
112 |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|