CCockrum commited on
Commit
d277616
·
verified ·
1 Parent(s): 8b7223b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -56,14 +56,13 @@ def safe_request(url):
56
  # (functions unchanged)
57
  # ...
58
 
59
- # Safe Request Function
60
- def safe_request(url):
61
- try:
62
- response = requests.get(url)
63
- response.raise_for_status()
64
- return response
65
- except:
66
- return None
67
 
68
  # Fetch Functions
69
  def get_company_info(symbol):
@@ -209,9 +208,7 @@ def stock_research(symbol, eps=5.0, growth=0.1, book=500000000):
209
  return summary, info_table, ratios_table, sector_comp, fig
210
 
211
  # Gradio UI
212
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as iface:
213
- theme_choice = gr.Radio(choices=["light", "dark"], value="light", label="Choose Theme")
214
-
215
  with gr.Row():
216
  symbol = gr.Textbox(label="Stock Symbol (e.g., AAPL)")
217
  eps = gr.Number(label="Assumed EPS", value=5.0)
@@ -251,5 +248,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as iface:
251
  outputs=[output_summary, output_info, output_ratios, output_sector, output_chart])
252
 
253
 
 
254
  if __name__ == "__main__":
255
  iface.launch()
 
56
  # (functions unchanged)
57
  # ...
58
 
59
+ # Theme Selection
60
+ selected_theme = os.getenv("APP_THEME", "light")
61
+ if selected_theme == "dark":
62
+ theme = gr.themes.Base()
63
+ else:
64
+ theme = gr.themes.Soft(primary_hue="blue")
65
+
 
66
 
67
  # Fetch Functions
68
  def get_company_info(symbol):
 
208
  return summary, info_table, ratios_table, sector_comp, fig
209
 
210
  # Gradio UI
211
+ with gr.Blocks(theme=theme) as iface:
 
 
212
  with gr.Row():
213
  symbol = gr.Textbox(label="Stock Symbol (e.g., AAPL)")
214
  eps = gr.Number(label="Assumed EPS", value=5.0)
 
248
  outputs=[output_summary, output_info, output_ratios, output_sector, output_chart])
249
 
250
 
251
+
252
  if __name__ == "__main__":
253
  iface.launch()