Method314 commited on
Commit
df42e91
·
verified ·
1 Parent(s): 5d5dab0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -25
app.py CHANGED
@@ -35,12 +35,12 @@ def plot_interactive_logarithmic_stock_chart(ticker, start_date, end_date):
35
 
36
  fig = go.Figure()
37
 
38
- fig.add_trace(go.Scatter(x=data.index, y=data['Close'], mode='lines', name='Close Price', line=dict(color='#3366CC')))
39
- fig.add_trace(go.Scatter(x=extended_dates, y=log_trend, mode='lines', name='Log Trend', line=dict(color='#DC3912')))
40
- fig.add_trace(go.Scatter(x=extended_dates, y=inner_upper_band, mode='lines', name='Inner Upper Band', line=dict(color='#FF9900')))
41
- fig.add_trace(go.Scatter(x=extended_dates, y=inner_lower_band, mode='lines', name='Inner Lower Band', line=dict(color='#FF9900')))
42
- fig.add_trace(go.Scatter(x=extended_dates, y=outer_upper_band, mode='lines', name='Outer Upper Band', line=dict(color='#109618')))
43
- fig.add_trace(go.Scatter(x=extended_dates, y=outer_lower_band, mode='lines', name='Outer Lower Band', line=dict(color='#109618')))
44
 
45
  fig.update_layout(
46
  title={
@@ -56,9 +56,9 @@ def plot_interactive_logarithmic_stock_chart(ticker, start_date, end_date):
56
  height=800,
57
  legend=dict(x=0.01, y=0.99, bgcolor='rgba(255, 255, 255, 0.8)'),
58
  hovermode='x unified',
59
- plot_bgcolor='#F5F5F5',
60
- paper_bgcolor='#F5F5F5',
61
- font=dict(family="Arial", size=12, color="#333333")
62
  )
63
 
64
  fig.update_xaxes(
@@ -81,22 +81,9 @@ def plot_interactive_logarithmic_stock_chart(ticker, start_date, end_date):
81
  # Get the current date
82
  current_date = datetime.now().strftime("%Y-%m-%d")
83
 
84
- # Custom CSS to make charts full-width and larger, and apply a theme
85
- custom_css = """
86
- .container {max-width: 100% !important; padding: 0 !important;}
87
- .plot-container {height: 800px !important; width: 100% !important;}
88
- .react-plotly-container {height: 100% !important; width: 100% !important;}
89
- body {background-color: #F5F5F5; color: #333333; font-family: Arial, sans-serif;}
90
- .gradio-container {background-color: #FFFFFF; border-radius: 10px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);}
91
- .gr-button {background-color: #3366CC; color: white;}
92
- .gr-button:hover {background-color: #254EDB;}
93
- .gr-input {border: 1px solid #CCCCCC; border-radius: 4px;}
94
- .gr-input:focus {border-color: #3366CC; box-shadow: 0 0 0 2px rgba(51, 102, 204, 0.2);}
95
- """
96
-
97
- # Create Gradio interface
98
- with gr.Blocks(css=custom_css, title="Stock Log Charts") as iface:
99
- gr.Markdown("# Stock Log Charts", elem_id="main-title")
100
  gr.Markdown("Enter a stock ticker and date range to generate a logarithmic chart.")
101
 
102
  with gr.Row():
 
35
 
36
  fig = go.Figure()
37
 
38
+ fig.add_trace(go.Scatter(x=data.index, y=data['Close'], mode='lines', name='Close Price', line=dict(color='#3A9184')))
39
+ fig.add_trace(go.Scatter(x=extended_dates, y=log_trend, mode='lines', name='Log Trend', line=dict(color='#FF8C61')))
40
+ fig.add_trace(go.Scatter(x=extended_dates, y=inner_upper_band, mode='lines', name='Inner Upper Band', line=dict(color='#6FB1A7')))
41
+ fig.add_trace(go.Scatter(x=extended_dates, y=inner_lower_band, mode='lines', name='Inner Lower Band', line=dict(color='#6FB1A7')))
42
+ fig.add_trace(go.Scatter(x=extended_dates, y=outer_upper_band, mode='lines', name='Outer Upper Band', line=dict(color='#FFC2A5')))
43
+ fig.add_trace(go.Scatter(x=extended_dates, y=outer_lower_band, mode='lines', name='Outer Lower Band', line=dict(color='#FFC2A5')))
44
 
45
  fig.update_layout(
46
  title={
 
56
  height=800,
57
  legend=dict(x=0.01, y=0.99, bgcolor='rgba(255, 255, 255, 0.8)'),
58
  hovermode='x unified',
59
+ plot_bgcolor='#F5F9F8',
60
+ paper_bgcolor='#F5F9F8',
61
+ font=dict(family="Inter, sans-serif", size=12, color="#313D38")
62
  )
63
 
64
  fig.update_xaxes(
 
81
  # Get the current date
82
  current_date = datetime.now().strftime("%Y-%m-%d")
83
 
84
+ # Create Gradio interface with seafoam theme
85
+ with gr.Blocks(theme=gr.themes.Seafoam(), title="Stock Log Charts") as iface:
86
+ gr.Markdown("# Stock Log Charts")
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  gr.Markdown("Enter a stock ticker and date range to generate a logarithmic chart.")
88
 
89
  with gr.Row():