Delete app.py
Browse files
app.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from transformers import pipeline
|
| 3 |
-
|
| 4 |
-
#def text_summarize(text):
|
| 5 |
-
# pipe = pipeline("summarization", model="human-centered-summarization/financial-summarization-pegasus")
|
| 6 |
-
# summary = pipe(text)[0]['summary_text']
|
| 7 |
-
# print(summary)
|
| 8 |
-
# return summary
|
| 9 |
-
|
| 10 |
-
def sentiment(summary):
|
| 11 |
-
pipe = pipeline("text-classification", model="WillWEI0103/CustomModel_finance_sentiment_analytics")
|
| 12 |
-
label = pipe(summary)[0]['label']
|
| 13 |
-
return label
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
def main():
|
| 17 |
-
st.set_page_config(page_title="Your Finance news", page_icon="📰")
|
| 18 |
-
st.header("Summarize Your Finance News and Analyze Sentiment")
|
| 19 |
-
text=st.text_input('Input your Finance news: ')
|
| 20 |
-
|
| 21 |
-
#Stage 1: Text Summarization
|
| 22 |
-
text_summarize=pipeline("summarization", model="nickmuchi/fb-bart-large-finetuned-trade-the-event-finance-summarizer")
|
| 23 |
-
#text_summarize=pipeline("summarization", model="human-centered-summarization/financial-summarization-pegasus")
|
| 24 |
-
summary = text_summarize(text)
|
| 25 |
-
summary = summary[0]['summary_text']
|
| 26 |
-
st.text('Processing Finance News Summarization...')
|
| 27 |
-
st.write(summary)
|
| 28 |
-
|
| 29 |
-
#Stage 2: Sentiment Analytics
|
| 30 |
-
st.text('Processing Sentiment Analytics...')
|
| 31 |
-
label = sentiment(summary)
|
| 32 |
-
st.text('The sentiment of finance news is: ')
|
| 33 |
-
st.write(label)
|
| 34 |
-
|
| 35 |
-
if __name__ == "__main__":
|
| 36 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|