aicodingfun commited on
Commit
a4f7684
·
verified ·
1 Parent(s): 6e82bf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -219,7 +219,19 @@ def get_top_bottom_news(date_obj):
219
 
220
  return f"<ul>{top_news_html}</ul>", f"<ul>{bottom_news_html}</ul>"
221
 
222
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="sky", secondary_hue="orange"), css=".gradio-container {background: #0B0F19}") as app:
 
 
 
 
 
 
 
 
 
 
 
 
223
  gr.Markdown(f"""<div style='text-align: center; padding: 20px; color: white;'><h1 style='font-size: 3em; color: #00BFFF;'>📈 Crypto Pulse</h1><p style='font-size: 1.2em; color: #A9A9A9;'>比特幣新聞情緒與價格分析儀表板</p><p style='font-size: 0.9em; color: #888;'>Designed by: {DEVELOPER_NAME}</p></div>""")
224
 
225
  max_date_dt = df.index.max()
 
219
 
220
  return f"<ul>{top_news_html}</ul>", f"<ul>{bottom_news_html}</ul>"
221
 
222
+ with gr.Blocks(
223
+ theme=gr.themes.Soft(primary_hue="sky", secondary_hue="orange"),
224
+ css=".gradio-container {background: #0B0F19}",
225
+ js="""
226
+ window.addEventListener('load', () => {
227
+ const u = new URL(window.location.href);
228
+ if (u.searchParams.get('__theme') !== 'dark') {
229
+ u.searchParams.set('__theme', 'dark');
230
+ window.location.replace(u);
231
+ }
232
+ });
233
+ """
234
+ ) as app:
235
  gr.Markdown(f"""<div style='text-align: center; padding: 20px; color: white;'><h1 style='font-size: 3em; color: #00BFFF;'>📈 Crypto Pulse</h1><p style='font-size: 1.2em; color: #A9A9A9;'>比特幣新聞情緒與價格分析儀表板</p><p style='font-size: 0.9em; color: #888;'>Designed by: {DEVELOPER_NAME}</p></div>""")
236
 
237
  max_date_dt = df.index.max()