Method314 commited on
Commit
e5bb596
·
verified ·
1 Parent(s): 439bbe7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -8
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,17 +134,28 @@ 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
 
142
  with gr.Row():
143
- ticker = gr.Textbox(label="Stock Ticker", value="MSFT")
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")
 
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 and input hover effects
138
+ custom_css = """
139
+ #generate-button:hover {
140
+ background-color: #FFB3BA !important; /* Pastel red */
141
+ }
142
+
143
+ #ticker-input input:hover, #start-date-input input:hover, #end-date-input input:hover {
144
+ background-color: #FFB3BA !important; /* Pastel red */
145
+ }
146
+ """
147
+
148
  # Create Gradio interface with custom Seafoam theme
149
+ with gr.Blocks(theme=seafoam, title="Stock Log Charts", css=custom_css) as iface:
150
  gr.Markdown("# Stock Log Charts")
151
  gr.Markdown("Enter a stock ticker and date range to generate a logarithmic chart.")
152
 
153
  with gr.Row():
154
+ ticker = gr.Textbox(label="Stock Ticker", value="MSFT", elem_id="ticker-input")
155
+ start_date = gr.Textbox(label="Start Date", value="2015-01-01", elem_id="start-date-input")
156
+ end_date = gr.Textbox(label="End Date", value=current_date, elem_id="end-date-input")
157
 
158
+ submit_button = gr.Button("Generate Chart", elem_id="generate-button")
159
 
160
  with gr.Row():
161
  log_plot = gr.Plot(label="Logarithmic Stock Chart")