Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,42 +1,22 @@
|
|
1 |
-
#
|
2 |
-
#
|
3 |
-
#
|
4 |
|
5 |
-
|
6 |
-
# from transformers import pipeline
|
7 |
-
|
8 |
-
# sentiment_pipeline = pipeline("sentiment-analysis")
|
9 |
-
|
10 |
-
# st.title("Financial Sentiment Analysis \n Team AI Supremo ")
|
11 |
-
# st.write("Enter a Financial Statement to Analyze the Sentiment:")
|
12 |
-
# user_input = st.text_input("")
|
13 |
-
# st.write("Press the Enter key")
|
14 |
-
|
15 |
-
# if user_input:
|
16 |
-
# result = sentiment_pipeline(user_input)
|
17 |
-
# sentiment = result[0]["label"]
|
18 |
-
# confidence = result[0]["score"]
|
19 |
-
|
20 |
-
# st.write(f"Sentiment: {sentiment}")
|
21 |
-
# st.write(f"Confidence: {confidence:.2%}")
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
from transformers import BertTokenizer, BertForSequenceClassification
|
26 |
from transformers import pipeline
|
27 |
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
|
|
|
|
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
"Raute reported a loss per share of EUR 0.86 for the first half of 2009 , against EPS of EUR 0.74 in the corresponding period of 2008.",
|
36 |
-
]
|
37 |
-
results = nlp(sentences)
|
38 |
-
print(results)
|
39 |
|
40 |
-
[{'label': 'positive', 'score': 0.9998133778572083},
|
41 |
-
{'label': 'neutral', 'score': 0.9997822642326355},
|
42 |
-
{'label': 'negative', 'score': 0.9877365231513977}]
|
|
|
1 |
+
# ***** Finacial Sentiment Analysis App *****
|
2 |
+
# Team *** AI Supremo
|
3 |
+
# Author *** Lerato Chere
|
4 |
|
5 |
+
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
from transformers import pipeline
|
7 |
|
8 |
+
sentiment_pipeline = pipeline("sentiment-analysis")
|
9 |
+
|
10 |
+
st.title("Financial Sentiment Analysis \n Team AI Supremo ")
|
11 |
+
st.write("Enter a Financial Statement to Analyze the Sentiment:")
|
12 |
+
user_input = st.text_input("")
|
13 |
+
st.write("Press the Enter key")
|
14 |
|
15 |
+
if user_input:
|
16 |
+
result = sentiment_pipeline(user_input)
|
17 |
+
sentiment = result[0]["label"]
|
18 |
+
confidence = result[0]["score"]
|
19 |
|
20 |
+
st.write(f"Sentiment: {sentiment}")
|
21 |
+
st.write(f"Confidence: {confidence:.2%}")
|
|
|
|
|
|
|
|
|
22 |
|
|
|
|
|
|