Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,6 @@ def analyze_financial_news():
|
|
7 |
|
8 |
# Load the text classification model pipeline
|
9 |
classification = pipeline("text-classification", model="nickmuchi/finbert-tone-finetuned-finance-topic-classification", token=access+token)
|
10 |
-
sentiment_analysis = pipeline("sentiment-analysis")
|
11 |
|
12 |
st.set_page_config(page_title="Financial News Analysis", page_icon="♕")
|
13 |
|
@@ -25,22 +24,8 @@ def analyze_financial_news():
|
|
25 |
# Perform text classification on the input text
|
26 |
results = classification(text)
|
27 |
|
28 |
-
#
|
29 |
-
|
30 |
-
|
31 |
-
if energy_oil_news:
|
32 |
-
# If there are news related to "Energy | Oil", perform sentiment analysis for each news
|
33 |
-
for news in energy_oil_news:
|
34 |
-
text = news["text"] # Corrected this line
|
35 |
-
sentiment_results = sentiment_analysis(text)[0]
|
36 |
-
|
37 |
-
# Display the sentiment analysis result for each news
|
38 |
-
st.write("Original Text:", text)
|
39 |
-
st.write("Sentiment:", sentiment_results["label"])
|
40 |
-
st.write("Sentiment Score:", sentiment_results["score"])
|
41 |
-
st.write("---")
|
42 |
-
else:
|
43 |
-
st.write("No news relevant to Energy | Oil.")
|
44 |
|
45 |
def main():
|
46 |
analyze_financial_news()
|
|
|
7 |
|
8 |
# Load the text classification model pipeline
|
9 |
classification = pipeline("text-classification", model="nickmuchi/finbert-tone-finetuned-finance-topic-classification", token=access+token)
|
|
|
10 |
|
11 |
st.set_page_config(page_title="Financial News Analysis", page_icon="♕")
|
12 |
|
|
|
24 |
# Perform text classification on the input text
|
25 |
results = classification(text)
|
26 |
|
27 |
+
# Display classification results structure
|
28 |
+
st.write("Classification Results:", results)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
def main():
|
31 |
analyze_financial_news()
|