Update app.py
Browse files
app.py
CHANGED
|
@@ -30,10 +30,11 @@ def analyze_financial_news():
|
|
| 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 |
sentiment_results = sentiment_analysis(news["sequence"])[0]
|
| 35 |
|
| 36 |
-
# Display the sentiment analysis result for each news
|
|
|
|
| 37 |
st.write("Original Text:", news["sequence"])
|
| 38 |
st.write("Sentiment:", sentiment_results["label"])
|
| 39 |
st.write("Sentiment Score:", sentiment_results["score"])
|
|
@@ -46,4 +47,3 @@ def main():
|
|
| 46 |
|
| 47 |
if __name__ == "__main__":
|
| 48 |
main()
|
| 49 |
-
|
|
|
|
| 30 |
|
| 31 |
if energy_oil_news:
|
| 32 |
# If there are news related to "Energy | Oil", perform sentiment analysis for each news
|
| 33 |
+
for idx, news in enumerate(energy_oil_news, start=1):
|
| 34 |
sentiment_results = sentiment_analysis(news["sequence"])[0]
|
| 35 |
|
| 36 |
+
# Display the index, original text, and sentiment analysis result for each news
|
| 37 |
+
st.write(f"News {idx}:")
|
| 38 |
st.write("Original Text:", news["sequence"])
|
| 39 |
st.write("Sentiment:", sentiment_results["label"])
|
| 40 |
st.write("Sentiment Score:", sentiment_results["score"])
|
|
|
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
| 49 |
main()
|
|
|