Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,8 @@ import time
|
|
5 |
def sentiment(summary):
|
6 |
pipe = pipeline("text-classification", model="WillWEI0103/CustomModel_finance_sentiment_analytics")
|
7 |
label = pipe(summary)[0]['label']
|
8 |
-
|
|
|
9 |
|
10 |
|
11 |
def main():
|
@@ -25,10 +26,11 @@ def main():
|
|
25 |
|
26 |
#Stage 2: Sentiment Analytics
|
27 |
with st.status("Processing Sentiment Analytics..") as status:
|
28 |
-
label = sentiment(summary)
|
29 |
label=dicts[label]
|
30 |
status.update(label="Sentiment Analytics Completed", state="complete", expanded=False)
|
31 |
-
st.
|
|
|
32 |
|
33 |
if __name__ == "__main__":
|
34 |
main()
|
|
|
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():
|
|
|
26 |
|
27 |
#Stage 2: Sentiment Analytics
|
28 |
with st.status("Processing Sentiment Analytics..") as status:
|
29 |
+
label,score = sentiment(summary)
|
30 |
label=dicts[label]
|
31 |
status.update(label="Sentiment Analytics Completed", state="complete", expanded=False)
|
32 |
+
st.text('The Sentiment of Finance News is: ',label)
|
33 |
+
st.text('The Score of Sentiment: ',score)
|
34 |
|
35 |
if __name__ == "__main__":
|
36 |
main()
|