mnawfal29 commited on
Commit
0945a7e
·
verified ·
1 Parent(s): d0556ae

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. demo/ui.py +6 -1
demo/ui.py CHANGED
@@ -763,18 +763,19 @@ footer, .gradio-container footer { display: none !important; }
763
  """
764
 
765
  # Plotly layout template — matches dark Claude palette.
 
766
  _PLOTLY_LAYOUT = dict(
767
  font=dict(family="Inter, -apple-system, system-ui, sans-serif",
768
  color="#f3f0e8", size=12),
769
  paper_bgcolor="#2a2824", # card surface
770
  plot_bgcolor="#1f1d1a", # page background, slightly darker
771
- margin=dict(l=60, r=30, t=60, b=55),
772
  hoverlabel=dict(bgcolor="#f3f0e8", font_color="#1f1d1a",
773
  font_family="Inter", bordercolor="#e28763"),
774
  legend=dict(bgcolor="rgba(31,29,26,0.85)",
775
  bordercolor="#403b34", borderwidth=1,
776
  font=dict(color="#f3f0e8")),
777
  )
 
778
  _AXIS_STYLE = dict(gridcolor="#403b34", zerolinecolor="#554e45",
779
  showline=True, linecolor="#554e45",
780
  tickfont=dict(color="#b5ada0"))
@@ -921,6 +922,7 @@ def _contour_plot(ls, trajectories=None, title=None, subtitle=None):
921
  **_PLOTLY_LAYOUT,
922
  title=dict(text=full_title, **_TITLE_STYLE),
923
  height=480,
 
924
  xaxis=dict(title="x₁", range=[x_min, x_max], **_AXIS_STYLE),
925
  yaxis=dict(title="x₂", range=[y_min, y_max],
926
  scaleanchor="x", scaleratio=1, **_AXIS_STYLE),
@@ -948,6 +950,7 @@ def _loss_curves(traj_map, title):
948
  **_PLOTLY_LAYOUT,
949
  title=dict(text=title, **_TITLE_STYLE),
950
  height=360,
 
951
  xaxis=dict(title="optimizer step", **_AXIS_STYLE),
952
  yaxis=dict(title="f(x) (symlog)", type="log", **_AXIS_STYLE),
953
  )
@@ -969,6 +972,7 @@ def _bar_plot(values, title, ylabel):
969
  **_PLOTLY_LAYOUT,
970
  title=dict(text=title, **_TITLE_STYLE),
971
  height=280,
 
972
  xaxis=dict(**_AXIS_STYLE),
973
  yaxis=dict(title=ylabel, **_AXIS_STYLE),
974
  showlegend=False,
@@ -1014,6 +1018,7 @@ def _empty_plot(msg):
1014
  fig.update_layout(
1015
  **_PLOTLY_LAYOUT,
1016
  height=480, showlegend=False,
 
1017
  xaxis=dict(visible=False), yaxis=dict(visible=False),
1018
  )
1019
  return fig
 
763
  """
764
 
765
  # Plotly layout template — matches dark Claude palette.
766
+ # Margin is intentionally factored out so per-plot overrides don't collide.
767
  _PLOTLY_LAYOUT = dict(
768
  font=dict(family="Inter, -apple-system, system-ui, sans-serif",
769
  color="#f3f0e8", size=12),
770
  paper_bgcolor="#2a2824", # card surface
771
  plot_bgcolor="#1f1d1a", # page background, slightly darker
 
772
  hoverlabel=dict(bgcolor="#f3f0e8", font_color="#1f1d1a",
773
  font_family="Inter", bordercolor="#e28763"),
774
  legend=dict(bgcolor="rgba(31,29,26,0.85)",
775
  bordercolor="#403b34", borderwidth=1,
776
  font=dict(color="#f3f0e8")),
777
  )
778
+ _DEFAULT_MARGIN = dict(l=60, r=30, t=60, b=55)
779
  _AXIS_STYLE = dict(gridcolor="#403b34", zerolinecolor="#554e45",
780
  showline=True, linecolor="#554e45",
781
  tickfont=dict(color="#b5ada0"))
 
922
  **_PLOTLY_LAYOUT,
923
  title=dict(text=full_title, **_TITLE_STYLE),
924
  height=480,
925
+ margin=_DEFAULT_MARGIN,
926
  xaxis=dict(title="x₁", range=[x_min, x_max], **_AXIS_STYLE),
927
  yaxis=dict(title="x₂", range=[y_min, y_max],
928
  scaleanchor="x", scaleratio=1, **_AXIS_STYLE),
 
950
  **_PLOTLY_LAYOUT,
951
  title=dict(text=title, **_TITLE_STYLE),
952
  height=360,
953
+ margin=_DEFAULT_MARGIN,
954
  xaxis=dict(title="optimizer step", **_AXIS_STYLE),
955
  yaxis=dict(title="f(x) (symlog)", type="log", **_AXIS_STYLE),
956
  )
 
972
  **_PLOTLY_LAYOUT,
973
  title=dict(text=title, **_TITLE_STYLE),
974
  height=280,
975
+ margin=_DEFAULT_MARGIN,
976
  xaxis=dict(**_AXIS_STYLE),
977
  yaxis=dict(title=ylabel, **_AXIS_STYLE),
978
  showlegend=False,
 
1018
  fig.update_layout(
1019
  **_PLOTLY_LAYOUT,
1020
  height=480, showlegend=False,
1021
+ margin=_DEFAULT_MARGIN,
1022
  xaxis=dict(visible=False), yaxis=dict(visible=False),
1023
  )
1024
  return fig