JerLag commited on
Commit
a9ce554
·
verified ·
1 Parent(s): dbf4e3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -21
app.py CHANGED
@@ -16,7 +16,7 @@ import plotly.io as pio
16
  VB_CSS = r"""
17
  @import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap');
18
 
19
- /* ---------- Variables Gradio (écrasent les thèmes host) ---------- */
20
  :root{
21
  --body-background-fill:#F8FAFC;
22
  --panel-background-fill:#FFFFFF;
@@ -29,25 +29,22 @@ VB_CSS = r"""
29
  --radius-lg:14px;
30
  --shadow-drop: 0 10px 26px rgba(2,6,23,.08);
31
 
32
- /* Accent (pas d’orange) */
33
  --color-accent:#7C3AED;
34
  --color-accent-soft:#EDE9FE;
35
  --button-primary-background-fill:#7C3AED;
36
  --button-primary-text-color:#ffffff;
37
 
38
- /* Inputs */
39
  --input-background-fill:#FFFFFF;
40
  --input-border-color:#E2E8F0;
41
  --input-text-color:#0F172A;
42
  --input-placeholder-color:#6B7280;
43
 
44
- /* Tables */
45
  --table-row-background-fill:#FFFFFF;
46
  --table-row-text-color:#0F172A;
47
  --table-border-color:#E2E8F0;
48
  }
49
 
50
- /* Palette dégradé violet → cyan */
51
  :root{
52
  --vb-bg:#F8FAFC;
53
  --vb-card:#FFFFFF;
@@ -63,7 +60,7 @@ VB_CSS = r"""
63
  --vb-shadow:0 10px 26px rgba(2,6,23,.08);
64
  }
65
 
66
- /* Forcer un look clair */
67
  * { color-scheme: light !important; }
68
  html,body,.gradio-container{
69
  background:var(--vb-bg) !important;
@@ -116,8 +113,7 @@ html,body,.gradio-container{
116
  border:none !important;
117
  padding:0 !important;
118
  }
119
-
120
- /* Ribbons collés en haut à gauche (bg-* neutral/gray…) */
121
  .gradio-container .wrap > div[class*="absolute"][class*="top-0"][class*="left-0"],
122
  .gradio-container [class*="absolute"][class*="top-0"][class*="left-0"][class*="rounded-b"],
123
  .gradio-container [class*="absolute"][class*="top-0"][class*="left-0"][class*="rounded-br"]{
@@ -127,7 +123,7 @@ html,body,.gradio-container{
127
  border:none !important;
128
  }
129
 
130
- /* ---------- Onglets / pagination internes (DataFrame, etc.) ---------- */
131
  .gradio-container [role="tablist"],
132
  .gradio-container [role="tab"]{
133
  background:#fff !important;
@@ -199,20 +195,31 @@ html,body,.gradio-container{
199
  }
200
  .gradio-container .vb-cta:hover{transform:translateY(-2px);filter:brightness(1.05)}
201
 
202
- /* ---------- DataFrames / Tables ---------- */
203
- .gradio-container [data-testid="dataframe"]{
204
- background:#fff !important; border:1px solid var(--vb-border) !important; border-radius:var(--vb-radius) !important;
205
- }
206
- .gradio-container [data-testid="dataframe"] *{
207
- background:#fff !important; color:#0F172A !important; border-color:#E2E8F0 !important;
 
 
 
208
  }
209
- .gradio-container thead th{
 
 
 
210
  background:linear-gradient(90deg, rgba(124,58,237,.12), rgba(6,182,212,.12)) !important;
211
- color:#111827 !important; font-weight:800 !important; border-bottom:1px solid var(--vb-border) !important;
212
  }
213
- .gradio-container td, .gradio-container th{
214
- padding:10px !important; border-bottom:1px solid #F1F5F9 !important;
 
 
 
215
  }
 
 
216
 
217
  /* ---------- Fichiers (gr.Files) ---------- */
218
  .gradio-container [class*="file"]{
@@ -577,7 +584,7 @@ def analyze_text(pasted_txt, has_sc, sep_chr,
577
  nps_label = "NPS global (inféré)" if any_inferred else "NPS global"
578
  lines=[ "# Synthèse NPS & ressentis clients",
579
  f"- **Méthode** : {method}",
580
- f"- **{nps_label}** : {nps:.1f}" if nps is not None else f"- **{npslabel}** : n/a" ]
581
  if dist:
582
  tot=sum(dist.values()); pos=dist.get("positive",0); neg=dist.get("negatif",0); neu=dist.get("neutre",0)
583
  lines.append(f"- **Répartition émotions** : positive {pos}/{tot}, neutre {neu}/{tot}, négative {neg}/{tot}")
@@ -641,7 +648,10 @@ def analyze_text(pasted_txt, has_sc, sep_chr,
641
 
642
  # ====================== UI ======================
643
 
644
- apply_plotly_theme()
 
 
 
645
 
646
  with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
647
  gr.HTML(
 
16
  VB_CSS = r"""
17
  @import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap');
18
 
19
+ /* Variables Gradio (on impose le thème clair + accents violet/cyan) */
20
  :root{
21
  --body-background-fill:#F8FAFC;
22
  --panel-background-fill:#FFFFFF;
 
29
  --radius-lg:14px;
30
  --shadow-drop: 0 10px 26px rgba(2,6,23,.08);
31
 
 
32
  --color-accent:#7C3AED;
33
  --color-accent-soft:#EDE9FE;
34
  --button-primary-background-fill:#7C3AED;
35
  --button-primary-text-color:#ffffff;
36
 
 
37
  --input-background-fill:#FFFFFF;
38
  --input-border-color:#E2E8F0;
39
  --input-text-color:#0F172A;
40
  --input-placeholder-color:#6B7280;
41
 
 
42
  --table-row-background-fill:#FFFFFF;
43
  --table-row-text-color:#0F172A;
44
  --table-border-color:#E2E8F0;
45
  }
46
 
47
+ /* Palette maison */
48
  :root{
49
  --vb-bg:#F8FAFC;
50
  --vb-card:#FFFFFF;
 
60
  --vb-shadow:0 10px 26px rgba(2,6,23,.08);
61
  }
62
 
63
+ /* Toujours en clair */
64
  * { color-scheme: light !important; }
65
  html,body,.gradio-container{
66
  background:var(--vb-bg) !important;
 
113
  border:none !important;
114
  padding:0 !important;
115
  }
116
+ /* Ribbons absolus en haut à gauche */
 
117
  .gradio-container .wrap > div[class*="absolute"][class*="top-0"][class*="left-0"],
118
  .gradio-container [class*="absolute"][class*="top-0"][class*="left-0"][class*="rounded-b"],
119
  .gradio-container [class*="absolute"][class*="top-0"][class*="left-0"][class*="rounded-br"]{
 
123
  border:none !important;
124
  }
125
 
126
+ /* ---------- Onglets / tablists internes ---------- */
127
  .gradio-container [role="tablist"],
128
  .gradio-container [role="tab"]{
129
  background:#fff !important;
 
195
  }
196
  .gradio-container .vb-cta:hover{transform:translateY(-2px);filter:brightness(1.05)}
197
 
198
+ /* ---------- DataFrames / Tables (anti-bandes noires) ---------- */
199
+ /* 1) Wrappers Svelte du tableau */
200
+ .gradio-container .table,
201
+ .gradio-container .table * ,
202
+ .gradio-container .svelte-virtual-table-viewport,
203
+ .gradio-container .table-wrap{
204
+ background:#fff !important;
205
+ color:#0F172A !important;
206
+ border-color:#E2E8F0 !important;
207
  }
208
+ /* 2) Ligne d’en-tête + boutons d’en-tête */
209
+ .gradio-container .table thead,
210
+ .gradio-container .table thead tr,
211
+ .gradio-container .table thead th{
212
  background:linear-gradient(90deg, rgba(124,58,237,.12), rgba(6,182,212,.12)) !important;
213
+ color:#0F172A !important; border-bottom:1px solid #E2E8F0 !important;
214
  }
215
+ .gradio-container .table thead th .header-button,
216
+ .gradio-container .table thead th [class*="header-button"],
217
+ .gradio-container .header-button{
218
+ background:transparent !important; color:#0F172A !important;
219
+ box-shadow:none !important; border:none !important;
220
  }
221
+ /* 3) Captions / titres internes */
222
+ .gradio-container .table caption{color:#0F172A !important}
223
 
224
  /* ---------- Fichiers (gr.Files) ---------- */
225
  .gradio-container [class*="file"]{
 
584
  nps_label = "NPS global (inféré)" if any_inferred else "NPS global"
585
  lines=[ "# Synthèse NPS & ressentis clients",
586
  f"- **Méthode** : {method}",
587
+ f"- **{nps_label}** : {nps:.1f}" if nps is not None else f"- **{nps_label}** : n/a" ]
588
  if dist:
589
  tot=sum(dist.values()); pos=dist.get("positive",0); neg=dist.get("negatif",0); neu=dist.get("neutre",0)
590
  lines.append(f"- **Répartition émotions** : positive {pos}/{tot}, neutre {neu}/{tot}, négative {neg}/{tot}")
 
648
 
649
  # ====================== UI ======================
650
 
651
+ def apply_plotly_theme_wrapper():
652
+ apply_plotly_theme()
653
+
654
+ apply_plotly_theme_wrapper()
655
 
656
  with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
657
  gr.HTML(