luisotorres commited on
Commit
343a02a
Β·
1 Parent(s): 3f66623

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -13
app.py CHANGED
@@ -90,8 +90,6 @@ def plot_volatility_bands(ticker, reference_year):
90
  print(f"Demand Level 2Οƒ: {Low_Band_2std.round(2)}\n")
91
  print(f"Demand Level 3Οƒ: {Low_Band_3std.round(2)}\n")
92
 
93
- # Creating an HTML extension of the Plotly figure
94
- fig_html = fig
95
 
96
  # Creating the text output
97
  text_info = f"""
@@ -105,29 +103,25 @@ def plot_volatility_bands(ticker, reference_year):
105
  Demand Level 3Οƒ: {Low_Band_3std.round(2)}\n
106
  """
107
 
108
- return fig_html, text_info
109
 
110
  def wrapper_func(ticker, reference_year):
111
  try:
112
- print(f"Debug: Ticker={ticker}, Reference Year={reference_year}")
113
- fig_html, text_info = plot_volatility_bands(ticker, str(int(reference_year)))
114
- print(f"Debug: fig_html={fig_html}, text_info={text_info}")
115
- return fig_html, text_info
116
  except Exception as e:
117
  error_message = str(e)
118
- print(f"Debug: Error={error_message}")
119
  return error_message, error_message
120
 
121
-
122
  iface = gr.Interface(
123
  fn=wrapper_func,
124
  inputs=[
125
- gr.inputs.Textbox(label="Enter the Ticker as it Appears on Yahoo Finance"),
126
- gr.inputs.Number(label="Enter the Year of Reference")
127
  ],
128
  outputs=[
129
- gr.outputs.Plotly(label="Candlestick Chart"),
130
- gr.outputs.Textbox(label="Supply and Demand Levels")
131
  ]
132
  )
133
 
 
90
  print(f"Demand Level 2Οƒ: {Low_Band_2std.round(2)}\n")
91
  print(f"Demand Level 3Οƒ: {Low_Band_3std.round(2)}\n")
92
 
 
 
93
 
94
  # Creating the text output
95
  text_info = f"""
 
103
  Demand Level 3Οƒ: {Low_Band_3std.round(2)}\n
104
  """
105
 
106
+ return fig, text_info
107
 
108
  def wrapper_func(ticker, reference_year):
109
  try:
110
+ fig, text_info = plot_volatility_bands(ticker, str(int(reference_year)))
111
+ return fig, text_info
 
 
112
  except Exception as e:
113
  error_message = str(e)
 
114
  return error_message, error_message
115
 
 
116
  iface = gr.Interface(
117
  fn=wrapper_func,
118
  inputs=[
119
+ gr.Textbox(label="Enter the Ticker as it Appears on Yahoo Finance"),
120
+ gr.Number(label="Enter the Year of Reference")
121
  ],
122
  outputs=[
123
+ gr.Plotly(label="Candlestick Chart"),
124
+ gr.Textbox(label="Supply and Demand Levels")
125
  ]
126
  )
127