Method314 commited on
Commit
bbb2bff
·
verified ·
1 Parent(s): 54f50bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -88,8 +88,8 @@ def plot_interactive_logarithmic_stock_chart(ticker, start_date, end_date):
88
 
89
  fig = go.Figure()
90
 
91
- fig.add_trace(go.Scatter(x=data.index, y=data['Close'], mode='lines', name='Close Price', line=dict(color='#3A9184')))
92
- fig.add_trace(go.Scatter(x=extended_dates, y=log_trend, mode='lines', name='Log Trend', line=dict(color='#FF8C61')))
93
  fig.add_trace(go.Scatter(x=extended_dates, y=inner_upper_band, mode='lines', name='Inner Upper Band', line=dict(color='#6FB1A7')))
94
  fig.add_trace(go.Scatter(x=extended_dates, y=inner_lower_band, mode='lines', name='Inner Lower Band', line=dict(color='#6FB1A7')))
95
  fig.add_trace(go.Scatter(x=extended_dates, y=outer_upper_band, mode='lines', name='Outer Upper Band', line=dict(color='#FFC2A5')))
@@ -97,7 +97,7 @@ def plot_interactive_logarithmic_stock_chart(ticker, start_date, end_date):
97
 
98
  fig.update_layout(
99
  title={
100
- 'text': 'Stock Log Charts',
101
  'y': 0.95,
102
  'x': 0.5,
103
  'xanchor': 'center',
@@ -134,8 +134,15 @@ def plot_interactive_logarithmic_stock_chart(ticker, start_date, end_date):
134
  # Get the current date
135
  current_date = datetime.now().strftime("%Y-%m-%d")
136
 
 
 
 
 
 
 
 
137
  # Create Gradio interface with custom Seafoam theme
138
- with gr.Blocks(theme=seafoam, title="Stock Log Charts") as iface:
139
  gr.Markdown("# Stock Log Charts")
140
  gr.Markdown("Enter a stock ticker and date range to generate a logarithmic chart.")
141
 
@@ -144,11 +151,13 @@ with gr.Blocks(theme=seafoam, title="Stock Log Charts") as iface:
144
  start_date = gr.Textbox(label="Start Date", value="2015-01-01")
145
  end_date = gr.Textbox(label="End Date", value=current_date)
146
 
147
- submit_button = gr.Button("Generate Chart")
148
 
149
  with gr.Row():
150
  log_plot = gr.Plot(label="Logarithmic Stock Chart")
151
 
 
 
152
  submit_button.click(
153
  plot_interactive_logarithmic_stock_chart,
154
  inputs=[ticker, start_date, end_date],
 
88
 
89
  fig = go.Figure()
90
 
91
+ fig.add_trace(go.Scatter(x=data.index, y=data['Close'], mode='lines', name='Close Price', line=dict(color='blue')))
92
+ fig.add_trace(go.Scatter(x=extended_dates, y=log_trend, mode='lines', name='Log Trend', line=dict(color='red')))
93
  fig.add_trace(go.Scatter(x=extended_dates, y=inner_upper_band, mode='lines', name='Inner Upper Band', line=dict(color='#6FB1A7')))
94
  fig.add_trace(go.Scatter(x=extended_dates, y=inner_lower_band, mode='lines', name='Inner Lower Band', line=dict(color='#6FB1A7')))
95
  fig.add_trace(go.Scatter(x=extended_dates, y=outer_upper_band, mode='lines', name='Outer Upper Band', line=dict(color='#FFC2A5')))
 
97
 
98
  fig.update_layout(
99
  title={
100
+ 'text': f'Stock Log Chart: {ticker}',
101
  'y': 0.95,
102
  'x': 0.5,
103
  'xanchor': 'center',
 
134
  # Get the current date
135
  current_date = datetime.now().strftime("%Y-%m-%d")
136
 
137
+ # Custom CSS for button hover effect
138
+ custom_css = """
139
+ #generate-button:hover {
140
+ background-color: #FFB3BA !important; /* Pastel red */
141
+ }
142
+ """
143
+
144
  # Create Gradio interface with custom Seafoam theme
145
+ with gr.Blocks(theme=seafoam, title="Stock Log Charts", css=custom_css) as iface:
146
  gr.Markdown("# Stock Log Charts")
147
  gr.Markdown("Enter a stock ticker and date range to generate a logarithmic chart.")
148
 
 
151
  start_date = gr.Textbox(label="Start Date", value="2015-01-01")
152
  end_date = gr.Textbox(label="End Date", value=current_date)
153
 
154
+ submit_button = gr.Button("Generate Chart", elem_id="generate-button")
155
 
156
  with gr.Row():
157
  log_plot = gr.Plot(label="Logarithmic Stock Chart")
158
 
159
+ share_button = gr.Button("Share Chart")
160
+
161
  submit_button.click(
162
  plot_interactive_logarithmic_stock_chart,
163
  inputs=[ticker, start_date, end_date],