Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,7 @@ import plotly.graph_objects as go
|
|
16 |
import plotly.io as pio
|
17 |
|
18 |
# ---------------- Branding Verbatify (CSS + Plotly) ----------------
|
|
|
19 |
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap');
|
20 |
|
21 |
/* ---------- Palette Verbatify ---------- */
|
@@ -35,7 +36,7 @@ import plotly.io as pio
|
|
35 |
--vb-shadow:0 10px 26px rgba(2,6,23,.08);
|
36 |
}
|
37 |
|
38 |
-
/*
|
39 |
* { color-scheme: light !important; }
|
40 |
|
41 |
html,body,.gradio-container{
|
@@ -47,7 +48,7 @@ html,body,.gradio-container{
|
|
47 |
/* largeur contenante */
|
48 |
.gradio-container{max-width:1120px !important;margin:0 auto !important}
|
49 |
|
50 |
-
/* ---------- Hero
|
51 |
.vb-hero{
|
52 |
display:flex;align-items:center;gap:16px;padding:20px 22px;margin:10px 0 20px;
|
53 |
background:linear-gradient(90deg, rgba(124,58,237,.12), rgba(6,182,212,.12));
|
@@ -70,10 +71,6 @@ html,body,.gradio-container{
|
|
70 |
box-shadow:var(--vb-shadow);
|
71 |
}
|
72 |
|
73 |
-
/* labels et titres internes */
|
74 |
-
.gr-markdown h1,.gr-markdown h2,.gr-markdown h3{color:var(--vb-text)}
|
75 |
-
.gr-markdown h2{font-size:18px;margin-top:10px}
|
76 |
-
|
77 |
/* ---------- Inputs ---------- */
|
78 |
.gradio-container input[type="text"],
|
79 |
.gradio-container input[type="number"],
|
@@ -132,7 +129,7 @@ button,.gr-button{
|
|
132 |
.js-plotly-plot .plotly .xgrid,.js-plotly-plot .plotly .ygrid{stroke:#E2E8F0 !important;opacity:1}
|
133 |
.js-plotly-plot .plotly .legend text{font-weight:600}
|
134 |
|
135 |
-
/* ---------- Chips
|
136 |
.vb-chip{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:700}
|
137 |
.vb-chip.pos{background:rgba(16,185,129,.12);color:#065F46}
|
138 |
.vb-chip.neu{background:rgba(148,163,184,.16);color:#334155}
|
@@ -140,7 +137,29 @@ button,.gr-button{
|
|
140 |
|
141 |
/* ---------- Footer ---------- */
|
142 |
.vb-footer{color:var(--vb-muted);font-size:12px;text-align:center;margin:16px 0}
|
|
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
# ---------------- unidecode (fallback si paquet absent) ----------------
|
146 |
try:
|
|
|
16 |
import plotly.io as pio
|
17 |
|
18 |
# ---------------- Branding Verbatify (CSS + Plotly) ----------------
|
19 |
+
VB_CSS = r"""
|
20 |
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap');
|
21 |
|
22 |
/* ---------- Palette Verbatify ---------- */
|
|
|
36 |
--vb-shadow:0 10px 26px rgba(2,6,23,.08);
|
37 |
}
|
38 |
|
39 |
+
/* forcer un look clair */
|
40 |
* { color-scheme: light !important; }
|
41 |
|
42 |
html,body,.gradio-container{
|
|
|
48 |
/* largeur contenante */
|
49 |
.gradio-container{max-width:1120px !important;margin:0 auto !important}
|
50 |
|
51 |
+
/* ---------- Hero ---------- */
|
52 |
.vb-hero{
|
53 |
display:flex;align-items:center;gap:16px;padding:20px 22px;margin:10px 0 20px;
|
54 |
background:linear-gradient(90deg, rgba(124,58,237,.12), rgba(6,182,212,.12));
|
|
|
71 |
box-shadow:var(--vb-shadow);
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
74 |
/* ---------- Inputs ---------- */
|
75 |
.gradio-container input[type="text"],
|
76 |
.gradio-container input[type="number"],
|
|
|
129 |
.js-plotly-plot .plotly .xgrid,.js-plotly-plot .plotly .ygrid{stroke:#E2E8F0 !important;opacity:1}
|
130 |
.js-plotly-plot .plotly .legend text{font-weight:600}
|
131 |
|
132 |
+
/* ---------- Chips ---------- */
|
133 |
.vb-chip{display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:700}
|
134 |
.vb-chip.pos{background:rgba(16,185,129,.12);color:#065F46}
|
135 |
.vb-chip.neu{background:rgba(148,163,184,.16);color:#334155}
|
|
|
137 |
|
138 |
/* ---------- Footer ---------- */
|
139 |
.vb-footer{color:var(--vb-muted);font-size:12px;text-align:center;margin:16px 0}
|
140 |
+
"""
|
141 |
|
142 |
+
def apply_plotly_theme():
|
143 |
+
pio.templates["verbatify"] = go.layout.Template(
|
144 |
+
layout=go.Layout(
|
145 |
+
font=dict(family="Manrope, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif", size=13, color="#0F172A"),
|
146 |
+
paper_bgcolor="white", plot_bgcolor="white",
|
147 |
+
colorway=["#7C3AED","#06B6D4","#2563EB","#10B981","#EF4444","#F59E0B","#14B8A6","#F43F5E"],
|
148 |
+
xaxis=dict(gridcolor="#E2E8F0", zerolinecolor="#E2E8F0"),
|
149 |
+
yaxis=dict(gridcolor="#E2E8F0", zerolinecolor="#E2E8F0"),
|
150 |
+
legend=dict(borderwidth=0, bgcolor="rgba(255,255,255,0)")
|
151 |
+
)
|
152 |
+
)
|
153 |
+
pio.templates.default = "verbatify"
|
154 |
+
|
155 |
+
LOGO_SVG = """<svg xmlns='http://www.w3.org/2000/svg' width='224' height='38' viewBox='0 0 224 38'>
|
156 |
+
<defs><linearGradient id='g' x1='0%' y1='0%' x2='100%'><stop offset='0%' stop-color='#7C3AED'/><stop offset='100%' stop-color='#06B6D4'/></linearGradient></defs>
|
157 |
+
<g fill='none' fill-rule='evenodd'>
|
158 |
+
<rect x='0' y='7' width='38' height='24' rx='12' fill='url(#g)'/>
|
159 |
+
<circle cx='13' cy='19' r='5' fill='#fff' opacity='0.95'/><circle cx='25' cy='19' r='5' fill='#fff' opacity='0.72'/>
|
160 |
+
<text x='46' y='25' font-family='Manrope, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif' font-size='20' font-weight='800' fill='#0F172A' letter-spacing='0.2'>Verbatify</text>
|
161 |
+
</g>
|
162 |
+
</svg>"""
|
163 |
|
164 |
# ---------------- unidecode (fallback si paquet absent) ----------------
|
165 |
try:
|