aicodingfun commited on
Commit
22c2bd2
·
verified ·
1 Parent(s): 4517269

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -17,7 +17,7 @@ DEVELOPER_NAME = "汪于捷、李哲弘、黃千宥、陳奕瑄、洪寓澤"
17
  NEWS_CSV_PATH = 'cryptonews.csv'
18
  BTC_CSV_PATH = 'BTC.csv'
19
  PROCESSED_DATA_PATH = 'processed_btc_sentiment_data.csv'
20
-
21
  SENTIMENT_PIPELINE = None
22
 
23
  def initialize_pipeline():
@@ -146,7 +146,7 @@ def plot_price_and_sentiment(filtered_df, sentiment_col, sentiment_name, color):
146
  yaxis=dict(title='價格 (USD)', color='deepskyblue'),
147
  yaxis2=dict(title='情緒分數', overlaying='y', side='right', color=color, range=[-1, 1]),
148
  legend=dict(x=0.01, y=0.99, orientation='h'),
149
- # template='plotly_dark',
150
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0.2)'
151
  )
152
  return fig
@@ -158,7 +158,7 @@ def plot_subjectivity_trend(filtered_df):
158
  # title='🧐 每日新聞主觀性趨勢',
159
  xaxis_title='日期',
160
  yaxis=dict(title='主觀性分數 (0=客觀, 1=主觀)', color='lightgreen', range=[0, 1]),
161
- # template='plotly_dark',
162
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0.2)'
163
  )
164
  return fig
@@ -175,7 +175,7 @@ def plot_correlation(filtered_df, sentiment_col, lag_days):
175
  fig.update_layout(
176
  title=f'🔗 情緒與 {lag_days} 天後價格變化的關聯性 (相關係數: {correlation:.3f})',
177
  xaxis_title='每日平均情緒分數', yaxis_title=f'{lag_days} 天後價格變化 (%)',
178
- # template='plotly_dark',
179
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0.2)'
180
  )
181
  return fig, correlation, p_value
 
17
  NEWS_CSV_PATH = 'cryptonews.csv'
18
  BTC_CSV_PATH = 'BTC.csv'
19
  PROCESSED_DATA_PATH = 'processed_btc_sentiment_data.csv'
20
+ PLOTLY_TEMPLATE = "plotly_dark"
21
  SENTIMENT_PIPELINE = None
22
 
23
  def initialize_pipeline():
 
146
  yaxis=dict(title='價格 (USD)', color='deepskyblue'),
147
  yaxis2=dict(title='情緒分數', overlaying='y', side='right', color=color, range=[-1, 1]),
148
  legend=dict(x=0.01, y=0.99, orientation='h'),
149
+ template=PLOTLY_TEMPLATE,
150
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0.2)'
151
  )
152
  return fig
 
158
  # title='🧐 每日新聞主觀性趨勢',
159
  xaxis_title='日期',
160
  yaxis=dict(title='主觀性分數 (0=客觀, 1=主觀)', color='lightgreen', range=[0, 1]),
161
+ template=PLOTLY_TEMPLATE,
162
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0.2)'
163
  )
164
  return fig
 
175
  fig.update_layout(
176
  title=f'🔗 情緒與 {lag_days} 天後價格變化的關聯性 (相關係數: {correlation:.3f})',
177
  xaxis_title='每日平均情緒分數', yaxis_title=f'{lag_days} 天後價格變化 (%)',
178
+ template=PLOTLY_TEMPLATE,
179
  paper_bgcolor='rgba(0,0,0,0)', plot_bgcolor='rgba(0,0,0,0.2)'
180
  )
181
  return fig, correlation, p_value