tosin2013 commited on
Commit
54ceda9
·
1 Parent(s): bc6abba

updating code

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -243,22 +243,29 @@ from gradio import inputs # Import the missing 'inputs' attribute from the 'gra
243
 
244
  api_key_link = "https://www.alphavantage.co/support/#api-key"
245
 
246
- # Run the Gradio app
 
 
 
 
 
 
 
 
 
 
 
247
  # Run the Gradio app
248
  if __name__ == "__main__":
249
  gr.Interface(
250
  fn=run_backtest,
251
  inputs=[
252
- inputs.Textbox(label="API Key", type="text", placeholder=api_key_link), # Use the imported 'inputs' attribute
253
- gr.inputs.Dropdown(label="From Currency", choices=from_currency_choices),
254
- gr.inputs.Dropdown(label="To Currency", choices=to_currency_choices),
255
  gr.inputs.Radio(label="Interval", choices=["1min", "5min", "15min", "30min", "60min"])
256
  ],
257
  outputs="html", # Output as HTML to display colored text
258
  live=True,
259
  title="Trading Signal",
260
  description="Run Backtest and Get Trading Signal",
261
- ).launch()
262
-
263
- #iface = gr.Interface(fn=greet, inputs="text", outputs="text")
264
- #iface.launch()
 
243
 
244
  api_key_link = "https://www.alphavantage.co/support/#api-key"
245
 
246
+
247
+ class APIKeyComponent(gr.Component):
248
+ def __init__(self):
249
+ super().__init__()
250
+ self.api_key = gr.inputs.Textbox(label="API Key", placeholder=api_key_link)
251
+
252
+ class CurrencyPairComponent(gr.Component):
253
+ def __init__(self):
254
+ super().__init__()
255
+ self.from_symbol = gr.inputs.Dropdown(label="From Currency", choices=['EUR', 'GBP', 'USD', 'AUD', 'JPY'])
256
+ self.to_symbol = gr.inputs.Dropdown(label="To Currency", choices=['USD', 'JPY', 'GBP', 'AUD', 'CAD'])
257
+
258
  # Run the Gradio app
259
  if __name__ == "__main__":
260
  gr.Interface(
261
  fn=run_backtest,
262
  inputs=[
263
+ APIKeyComponent(),
264
+ CurrencyPairComponent(),
 
265
  gr.inputs.Radio(label="Interval", choices=["1min", "5min", "15min", "30min", "60min"])
266
  ],
267
  outputs="html", # Output as HTML to display colored text
268
  live=True,
269
  title="Trading Signal",
270
  description="Run Backtest and Get Trading Signal",
271
+ ).launch()