EricSam commited on
Commit
f935bc9
Β·
verified Β·
1 Parent(s): 076697e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -169,7 +169,7 @@ def update_allocation_chart(allocation):
169
  </div>
170
  </div>
171
  """ for i, (label, data) in enumerate(zip(allocation['labels'], allocation['data'])))
172
- return gr.PiePlot(value=chart_data), gr.HTML(legend_html)
173
 
174
  # Main Data Fetch and Update Function
175
  def update_dashboard(api_key, api_secret):
@@ -199,7 +199,7 @@ def update_dashboard(api_key, api_secret):
199
  return (
200
  "$Loading...", 0, "0 Long β€’ 0 Short", "$0.00", "Low", "0%", gr.HTML("<tr><td colspan='8' class='py-4 text-center'>Error: Failed to sync with BingX API - Check credentials</td></tr>"),
201
  gr.HTML("<div>Error loading stats</div>"), gr.LinePlot(value={'x': [], 'y': [], 'color': [], 'title': 'Monthly Performance'}),
202
- (gr.PiePlot(value={'names': [], 'values': [], 'colors': [], 'title': 'Portfolio Allocation'}), gr.HTML("")), "Just now", "Just now"
203
  )
204
 
205
  # Save Credentials Function
@@ -295,7 +295,7 @@ with gr.Blocks(title="Nakhoda4X Pro") as demo:
295
  portfolio_allocation = gr.Blocks()
296
  with portfolio_allocation:
297
  gr.HTML("<div class='bg-white dark:bg-darkCard rounded-2xl shadow-md p-6'><div class='flex justify-between items-center mb-6'><h3 class='text-lg font-bold text-gray-800 dark:text-white'>Portfolio Allocation</h3><div><span id='allocation-update' class='text-gray-500 dark:text-gray-400 text-sm'>Last updated: Just now</span></div></div>")
298
- allocation_chart, allocation_legend = gr.PiePlot(), gr.HTML()
299
 
300
  # Event Handlers
301
  toggle_btn.click(fn=toggle_api_form, inputs=[show_form], outputs=[api_form], _js="() => !document.querySelector('.api-form').classList.contains('open')")
 
169
  </div>
170
  </div>
171
  """ for i, (label, data) in enumerate(zip(allocation['labels'], allocation['data'])))
172
+ return gr.Pie(value=chart_data), gr.HTML(legend_html)
173
 
174
  # Main Data Fetch and Update Function
175
  def update_dashboard(api_key, api_secret):
 
199
  return (
200
  "$Loading...", 0, "0 Long β€’ 0 Short", "$0.00", "Low", "0%", gr.HTML("<tr><td colspan='8' class='py-4 text-center'>Error: Failed to sync with BingX API - Check credentials</td></tr>"),
201
  gr.HTML("<div>Error loading stats</div>"), gr.LinePlot(value={'x': [], 'y': [], 'color': [], 'title': 'Monthly Performance'}),
202
+ (gr.Pie(value={'names': [], 'values': [], 'colors': [], 'title': 'Portfolio Allocation'}), gr.HTML("")), "Just now", "Just now"
203
  )
204
 
205
  # Save Credentials Function
 
295
  portfolio_allocation = gr.Blocks()
296
  with portfolio_allocation:
297
  gr.HTML("<div class='bg-white dark:bg-darkCard rounded-2xl shadow-md p-6'><div class='flex justify-between items-center mb-6'><h3 class='text-lg font-bold text-gray-800 dark:text-white'>Portfolio Allocation</h3><div><span id='allocation-update' class='text-gray-500 dark:text-gray-400 text-sm'>Last updated: Just now</span></div></div>")
298
+ allocation_chart, allocation_legend = gr.Pie(), gr.HTML()
299
 
300
  # Event Handlers
301
  toggle_btn.click(fn=toggle_api_form, inputs=[show_form], outputs=[api_form], _js="() => !document.querySelector('.api-form').classList.contains('open')")