desinez commited on
Commit
bbb1641
·
1 Parent(s): f661b88

updating frontend

Browse files
Files changed (1) hide show
  1. frontend/app.py +20 -9
frontend/app.py CHANGED
@@ -58,7 +58,7 @@ sidebar = html.Div(
58
  className="flex-column"
59
  ),
60
 
61
- # Theme Switch Component Setup (Syntax Error Fixed Here)
62
  html.Div([
63
  html.Hr(style={"marginBottom": "1.5rem"}),
64
  html.Label([html.I(className="fas fa-adjust me-2"), "Interface Theme"], id="theme-label", className="small d-block mb-2 font-weight-bold"),
@@ -336,7 +336,7 @@ def download_sample_data(n_clicks):
336
  sample_path = os.path.join(base_dir, 'backend', 'PvDeepSetNet', 'src', 'DeepSets', 'datasets', 'GUI_sample_dataset.csv')
337
 
338
  sample_df = pd.read_csv(sample_path)
339
- return dcc.send_data_frame(sample_df.to_csv, "pvrecnet_sample_data.csv", index=False)
340
 
341
 
342
  # --- FUNCTIONAL DATA UPLOAD STORAGE INTERFACE ---
@@ -381,22 +381,33 @@ def run_predict(n_clicks, dataset_id, theme):
381
  fig1 = model_output.get('donut_plot')
382
  fig2 = model_output.get('distribution_plot')
383
 
384
- # Establish high-contrast responsive legends and typography colors
385
- chart_text = '#f8fafc' if theme == 'dark' else '#0f172a'
 
 
386
  for fig in [fig1, fig2]:
387
  if fig:
388
  if hasattr(fig, 'update_layout'):
389
  fig.update_layout(
390
  paper_bgcolor='rgba(0,0,0,0)',
391
  plot_bgcolor='rgba(0,0,0,0)',
392
- font_color=chart_text,
393
- legend=dict(font=dict(color=chart_text), bgcolor='rgba(0,0,0,0)')
 
 
 
 
394
  )
395
- elif isinstance(fig, dict) and 'layout' in fig:
 
 
396
  fig['layout']['paper_bgcolor'] = 'rgba(0,0,0,0)'
397
  fig['layout']['plot_bgcolor'] = 'rgba(0,0,0,0)'
398
- fig['layout']['font'] = {'color': chart_text}
399
- fig['layout']['legend'] = {'font': {'color': chart_text}, 'bgcolor': 'rgba(0,0,0,0)'}
 
 
 
400
 
401
  df_res = pd.DataFrame(model_output['results_table'])
402
  prob_cols = ['C_marg', 'L_marg', 'I_marg']
 
58
  className="flex-column"
59
  ),
60
 
61
+ # Theme Switch Component Setup
62
  html.Div([
63
  html.Hr(style={"marginBottom": "1.5rem"}),
64
  html.Label([html.I(className="fas fa-adjust me-2"), "Interface Theme"], id="theme-label", className="small d-block mb-2 font-weight-bold"),
 
336
  sample_path = os.path.join(base_dir, 'backend', 'PvDeepSetNet', 'src', 'DeepSets', 'datasets', 'GUI_sample_dataset.csv')
337
 
338
  sample_df = pd.read_csv(sample_path)
339
+ return dcc.send_data_frame(sample_df.to_csv", "pvrecnet_sample_data.csv", index=False)
340
 
341
 
342
  # --- FUNCTIONAL DATA UPLOAD STORAGE INTERFACE ---
 
381
  fig1 = model_output.get('donut_plot')
382
  fig2 = model_output.get('distribution_plot')
383
 
384
+ # Assign high-contrast layout configurations explicitly overriding layout dict traces
385
+ chart_text = '#cbd5e1' if theme == 'dark' else '#0f172a'
386
+
387
+ # Explicit full dictionary configuration injection strategy to ensure plot elements change cleanly
388
  for fig in [fig1, fig2]:
389
  if fig:
390
  if hasattr(fig, 'update_layout'):
391
  fig.update_layout(
392
  paper_bgcolor='rgba(0,0,0,0)',
393
  plot_bgcolor='rgba(0,0,0,0)',
394
+ font=dict(color=chart_text, size=12),
395
+ legend=dict(
396
+ font=dict(color=chart_text),
397
+ bgcolor='rgba(0,0,0,0)',
398
+ itemwidth=40
399
+ )
400
  )
401
+ elif isinstance(fig, dict):
402
+ if 'layout' not in fig:
403
+ fig['layout'] = {}
404
  fig['layout']['paper_bgcolor'] = 'rgba(0,0,0,0)'
405
  fig['layout']['plot_bgcolor'] = 'rgba(0,0,0,0)'
406
+ fig['layout']['font'] = {'color': chart_text, 'size': 12}
407
+ fig['layout']['legend'] = {
408
+ 'font': {'color': chart_text},
409
+ 'bgcolor': 'rgba(0,0,0,0)'
410
+ }
411
 
412
  df_res = pd.DataFrame(model_output['results_table'])
413
  prob_cols = ['C_marg', 'L_marg', 'I_marg']