@@ -54,7 +54,7 @@ def loss_fn(s):
5454 "border" : "#e4e1d6" ,
5555 "text" : "#0f172a" ,
5656 "muted" : "#64748b" ,
57- "accent" : "#0f766e" , # deep teal
57+ "accent" : "#0f766e" , # deep teal
5858 "accent2" : "#be5a3c" , # warm terracotta
5959 "grid" : "#e5e7eb" ,
6060 "palette" : ["#0f766e" , "#be5a3c" , "#1e3a8a" , "#b45309" , "#6d28d9" , "#047857" ],
@@ -112,15 +112,16 @@ def plotly_layout(theme: str | None = None, **overrides) -> dict:
112112 "template" : "plotly_white" if (theme or get_theme ()) == "light" else "plotly_dark" ,
113113 "paper_bgcolor" : "rgba(0,0,0,0)" ,
114114 "plot_bgcolor" : "rgba(0,0,0,0)" ,
115- "font" : {"family" : "Inter, -apple-system, sans-serif" , "size" : 13 ,
116- "color" : p ["text" ]},
117- "title_font" : {"family" : "'Source Serif 4', Georgia, serif" ,
118- "size" : 17 , "color" : p ["text" ]},
115+ "font" : {"family" : "Inter, -apple-system, sans-serif" , "size" : 13 , "color" : p ["text" ]},
116+ "title_font" : {
117+ "family" : "'Source Serif 4', Georgia, serif" ,
118+ "size" : 17 ,
119+ "color" : p ["text" ],
120+ },
119121 "colorway" : p ["palette" ],
120122 "xaxis" : {"gridcolor" : p ["grid" ], "linecolor" : p ["border" ], "zerolinecolor" : p ["grid" ]},
121123 "yaxis" : {"gridcolor" : p ["grid" ], "linecolor" : p ["border" ], "zerolinecolor" : p ["grid" ]},
122- "legend" : {"bgcolor" : "rgba(0,0,0,0)" , "bordercolor" : p ["border" ],
123- "borderwidth" : 0.5 },
124+ "legend" : {"bgcolor" : "rgba(0,0,0,0)" , "bordercolor" : p ["border" ], "borderwidth" : 0.5 },
124125 "margin" : {"l" : 50 , "r" : 20 , "t" : 48 , "b" : 46 },
125126 }
126127 base .update (overrides )
@@ -137,13 +138,13 @@ def apply_theme() -> None:
137138 <style>
138139 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&display=swap');
139140 :root {{
140- --qqa-bg: { p ['bg' ]} ;
141- --qqa-card: { p [' bg_card' ]} ;
142- --qqa-border: { p [' border' ]} ;
143- --qqa-text: { p [' text' ]} ;
144- --qqa-muted: { p [' muted' ]} ;
145- --qqa-accent: { p [' accent' ]} ;
146- --qqa-accent2: { p [' accent2' ]} ;
141+ --qqa-bg: { p ["bg" ]} ;
142+ --qqa-card: { p [" bg_card" ]} ;
143+ --qqa-border: { p [" border" ]} ;
144+ --qqa-text: { p [" text" ]} ;
145+ --qqa-muted: { p [" muted" ]} ;
146+ --qqa-accent: { p [" accent" ]} ;
147+ --qqa-accent2: { p [" accent2" ]} ;
147148 }}
148149 html, body, [class*="css"] {{
149150 font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
@@ -156,7 +157,7 @@ def apply_theme() -> None:
156157 color: var(--qqa-text);
157158 }}
158159 section[data-testid="stSidebar"] {{
159- background: { p [' bg_sidebar' ]} ;
160+ background: { p [" bg_sidebar" ]} ;
160161 border-right: 1px solid var(--qqa-border);
161162 }}
162163 h1, h2, h3, h4 {{
@@ -286,13 +287,13 @@ def apply_theme() -> None:
286287 <style>
287288 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&display=swap');
288289 :root {{
289- --qqa-bg: { p ['bg' ]} ;
290- --qqa-card: { p [' bg_card' ]} ;
291- --qqa-border: { p [' border' ]} ;
292- --qqa-text: { p [' text' ]} ;
293- --qqa-muted: { p [' muted' ]} ;
294- --qqa-accent: { p [' accent' ]} ;
295- --qqa-accent2: { p [' accent2' ]} ;
290+ --qqa-bg: { p ["bg" ]} ;
291+ --qqa-card: { p [" bg_card" ]} ;
292+ --qqa-border: { p [" border" ]} ;
293+ --qqa-text: { p [" text" ]} ;
294+ --qqa-muted: { p [" muted" ]} ;
295+ --qqa-accent: { p [" accent" ]} ;
296+ --qqa-accent2: { p [" accent2" ]} ;
296297 }}
297298 html, body, [class*="css"] {{ font-family: 'Inter', sans-serif; }}
298299 .stApp {{
@@ -303,7 +304,7 @@ def apply_theme() -> None:
303304 color: var(--qqa-text);
304305 }}
305306 section[data-testid="stSidebar"] {{
306- background: { p [' bg_sidebar' ]} ;
307+ background: { p [" bg_sidebar" ]} ;
307308 backdrop-filter: blur(14px);
308309 border-right: 1px solid var(--qqa-border);
309310 }}
@@ -408,15 +409,10 @@ def render_score_card(score: dict, raw_loss: float | None = None) -> None:
408409 else '<span class="qqa-badge warn">infeasible</span>'
409410 )
410411 value = score .get ("value" , "-" )
411- if isinstance (value , float ):
412- value_s = f"{ value :.4g} "
413- else :
414- value_s = str (value )
412+ value_s = f"{ value :.4g} " if isinstance (value , float ) else str (value )
415413 unit = score .get ("unit" , "" )
416414 unit_html = f'<span class="unit">{ unit } </span>' if unit else ""
417- raw_html = (
418- f'<div class="raw">raw loss = { raw_loss :.4g} </div>' if raw_loss is not None else ""
419- )
415+ raw_html = f'<div class="raw">raw loss = { raw_loss :.4g} </div>' if raw_loss is not None else ""
420416 value_cls = "value" if feas else "value infeasible"
421417 st .markdown (
422418 f'<div class="qqa-score">'
@@ -584,7 +580,7 @@ def _graph_preview(g: nx.Graph, title: str) -> None:
584580 yaxis = {"visible" : False },
585581 height = 380 ,
586582 )
587- st .plotly_chart (fig , width = ' stretch' )
583+ st .plotly_chart (fig , width = " stretch" )
588584
589585
590586def _coupling_preview (J : np .ndarray , title : str ) -> None :
@@ -595,7 +591,7 @@ def _coupling_preview(J: np.ndarray, title: str) -> None:
595591 plot_bgcolor = "rgba(0,0,0,0)" ,
596592 height = 400 ,
597593 )
598- st .plotly_chart (fig , width = ' stretch' )
594+ st .plotly_chart (fig , width = " stretch" )
599595
600596
601597def preview_problem (problem : Any , cfg : dict ) -> None :
@@ -619,7 +615,7 @@ def preview_problem(problem: Any, cfg: dict) -> None:
619615 plot_bgcolor = "rgba(0,0,0,0)" ,
620616 height = 400 ,
621617 )
622- st .plotly_chart (fig , width = ' stretch' )
618+ st .plotly_chart (fig , width = " stretch" )
623619 return
624620 if kind == "custom" :
625621 import torch
0 commit comments