Update app.py
Browse files
app.py
CHANGED
|
@@ -12,12 +12,26 @@ import plotly.express as px
|
|
| 12 |
import plotly.graph_objects as go
|
| 13 |
import plotly.io as pio
|
| 14 |
|
| 15 |
-
# ====================== CSS externe (
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# ====================== PLOTLY THEME ======================
|
| 23 |
def apply_plotly_theme():
|
|
@@ -422,10 +436,7 @@ def analyze_text(pasted_txt, has_sc, sep_chr,
|
|
| 422 |
# ====================== UI ======================
|
| 423 |
apply_plotly_theme()
|
| 424 |
|
| 425 |
-
with gr.Blocks(
|
| 426 |
-
title="Verbatify — Analyse NPS",
|
| 427 |
-
css=VB_CSS,
|
| 428 |
-
) as demo:
|
| 429 |
gr.HTML(
|
| 430 |
"<div class='vb-hero'>"
|
| 431 |
f"{LOGO_SVG}"
|
|
@@ -440,7 +451,7 @@ with gr.Blocks(
|
|
| 440 |
placeholder="Exemple :\nRemboursement rapide, télétransmission OK | 10\nImpossible de joindre un conseiller | 3\nEspace client : bug à la connexion | 4",
|
| 441 |
)
|
| 442 |
with gr.Row():
|
| 443 |
-
has_score = gr.Checkbox(label="J’ai un score NPS par ligne", value=True)
|
| 444 |
sep = gr.Textbox(label="Séparateur score", value="|", scale=1)
|
| 445 |
|
| 446 |
with gr.Row():
|
|
|
|
| 12 |
import plotly.graph_objects as go
|
| 13 |
import plotly.io as pio
|
| 14 |
|
| 15 |
+
# ====================== CSS externe (charge verbatim.css OU verbatify.css) ======================
|
| 16 |
+
def load_css() -> str:
|
| 17 |
+
candidates = [
|
| 18 |
+
"verbatim.css", "verbatify.css", # racine
|
| 19 |
+
"assets/verbatim.css", "assets/verbatify.css" # sous-dossier éventuel
|
| 20 |
+
]
|
| 21 |
+
here = Path(__file__).parent
|
| 22 |
+
for name in candidates:
|
| 23 |
+
p = here / name
|
| 24 |
+
if p.exists():
|
| 25 |
+
css = p.read_text(encoding="utf-8")
|
| 26 |
+
print(f"[Verbatify] CSS chargé: {p.name}")
|
| 27 |
+
return css
|
| 28 |
+
print("[Verbatify] ⚠️ Aucun fichier CSS trouvé (verbatim.css / verbatify.css).")
|
| 29 |
+
# filet de sécurité visuel
|
| 30 |
+
return """
|
| 31 |
+
html,body,.gradio-container{background:#ffffff!important;color:#0F172A!important}
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
VB_CSS = load_css()
|
| 35 |
|
| 36 |
# ====================== PLOTLY THEME ======================
|
| 37 |
def apply_plotly_theme():
|
|
|
|
| 436 |
# ====================== UI ======================
|
| 437 |
apply_plotly_theme()
|
| 438 |
|
| 439 |
+
with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
|
|
|
|
|
|
|
|
|
|
| 440 |
gr.HTML(
|
| 441 |
"<div class='vb-hero'>"
|
| 442 |
f"{LOGO_SVG}"
|
|
|
|
| 451 |
placeholder="Exemple :\nRemboursement rapide, télétransmission OK | 10\nImpossible de joindre un conseiller | 3\nEspace client : bug à la connexion | 4",
|
| 452 |
)
|
| 453 |
with gr.Row():
|
| 454 |
+
has_score = gr.Checkbox(label="J’ai un score NPS par ligne", value=True) # déjà coché
|
| 455 |
sep = gr.Textbox(label="Séparateur score", value="|", scale=1)
|
| 456 |
|
| 457 |
with gr.Row():
|