Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
# ✅ 必须作为第一个 Streamlit 命令
|
4 |
st.set_page_config(page_title="Stock News Sentiment Analysis", layout="centered")
|
5 |
|
6 |
from func import (
|
@@ -70,9 +69,9 @@ if st.button("Get News and Sentiment"):
|
|
70 |
positive_ratio = positive_count / total if total else 0
|
71 |
negative_ratio = negative_count / total if total else 0
|
72 |
|
73 |
-
if positive_ratio >= 0.
|
74 |
overall_sentiment = "Positive"
|
75 |
-
elif negative_ratio >= 0.
|
76 |
overall_sentiment = "Negative"
|
77 |
else:
|
78 |
overall_sentiment = "Neutral"
|
|
|
1 |
import streamlit as st
|
2 |
|
|
|
3 |
st.set_page_config(page_title="Stock News Sentiment Analysis", layout="centered")
|
4 |
|
5 |
from func import (
|
|
|
69 |
positive_ratio = positive_count / total if total else 0
|
70 |
negative_ratio = negative_count / total if total else 0
|
71 |
|
72 |
+
if positive_ratio >= 0.3:
|
73 |
overall_sentiment = "Positive"
|
74 |
+
elif negative_ratio >= 0.7:
|
75 |
overall_sentiment = "Negative"
|
76 |
else:
|
77 |
overall_sentiment = "Neutral"
|