WillWEI0103 commited on
Commit
b1ae66a
·
verified ·
1 Parent(s): f17a5f3

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -37
app.py DELETED
@@ -1,37 +0,0 @@
1
- import streamlit as st
2
- from transformers import pipeline
3
- import time
4
-
5
- def sentiment(summary):
6
- pipe = pipeline("text-classification", model="WillWEI0103/CustomModel_finance_sentiment_analytics")
7
- label = pipe(summary)[0]['label']
8
- score = pipe(summary)[0]['score']
9
- return label,score
10
-
11
-
12
- def main():
13
- dicts={"bullish":'Positive📈',"bearish":'Negative📉','neutral':"Neutral😐"}
14
- st.header("Summarize Your Finance News and Analyze Sentiment📰")
15
- text=st.text_input('Input your Finance news(Max lenth<=3000): ',None,max_chars=3000)
16
- if text is not None:
17
- st.text_area('Your Finance News: ',text,height=100)
18
-
19
- #Stage 1: Text Summarization
20
- with st.status("Processing Finance News Summarization...") as status:
21
- text_summarize=pipeline("summarization", model="nickmuchi/fb-bart-large-finetuned-trade-the-event-finance-summarizer")
22
- summary=text_summarize(text,min_length=140)[0]['summary_text']
23
- status.update(label="Summarization Completed", state="complete", expanded=False)
24
- st.text_area('Your Finance News Summary',summary,height=30)
25
-
26
- #Stage 2: Sentiment Analytics
27
- with st.status("Processing Sentiment Analytics..") as status:
28
- label,score = sentiment(summary)
29
- label=dicts[label]
30
- status.update(label="Sentiment Analytics Completed", state="complete", expanded=False)
31
- st.text('The Sentiment of the Finance News is: ')
32
- st.text(label)
33
- st.text('The Sentiment Score: ')
34
- st.text(round(score,3))
35
-
36
- if __name__ == "__main__":
37
- main()