Update app.py
Browse files
app.py
CHANGED
@@ -448,7 +448,9 @@ def analyze_text(pasted_txt, has_sc, sep_chr,
|
|
448 |
|
449 |
# ---------------- UI ----------------
|
450 |
apply_plotly_theme()
|
|
|
451 |
with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
|
|
|
452 |
gr.HTML(
|
453 |
"<div class='vb-hero'>"
|
454 |
f"{LOGO_SVG}"
|
@@ -457,9 +459,12 @@ with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
|
|
457 |
"</div>"
|
458 |
)
|
459 |
|
|
|
460 |
with gr.Column():
|
461 |
-
pasted = gr.Textbox(
|
462 |
-
|
|
|
|
|
463 |
with gr.Row():
|
464 |
has_score = gr.Checkbox(label="J’ai un score NPS par ligne", value=False)
|
465 |
sep = gr.Textbox(label="Séparateur score", value="|", scale=1)
|
@@ -476,14 +481,19 @@ with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
|
|
476 |
top_k=gr.Slider(label="Top thèmes (K) pour les graphes", minimum=5, maximum=20, value=10, step=1)
|
477 |
run=gr.Button("Lancer l'analyse", variant="primary")
|
478 |
|
|
|
479 |
with gr.Row():
|
480 |
-
ench_panel=gr.Markdown()
|
|
|
|
|
481 |
|
482 |
-
|
|
|
483 |
themes_table=gr.Dataframe(label="Thèmes — statistiques")
|
484 |
enriched_table=gr.Dataframe(label="Verbatims enrichis (aperçu)")
|
485 |
files_out=gr.Files(label="Téléchargements (CSV & ZIP)")
|
486 |
|
|
|
487 |
with gr.Row():
|
488 |
plot_nps = gr.Plot(label="NPS — Jauge")
|
489 |
plot_sent= gr.Plot(label="Répartition des émotions")
|
@@ -491,34 +501,20 @@ with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
|
|
491 |
plot_top = gr.Plot(label="Top thèmes — occurrences")
|
492 |
plot_bal = gr.Plot(label="Top thèmes — balance Pos/Neg")
|
493 |
|
|
|
494 |
run.click(
|
495 |
analyze_text,
|
496 |
inputs=[pasted, has_score, sep, anon, use_oa_sent, use_oa_themes, use_oa_summary, oa_model, oa_temp, top_k],
|
497 |
-
outputs=[summary, themes_table, enriched_table, files_out,
|
498 |
-
|
499 |
-
|
500 |
-
# ---------------- UI ----------------
|
501 |
-
apply_plotly_theme()
|
502 |
-
with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
|
503 |
-
gr.HTML(
|
504 |
-
"<div class='vb-hero'>"
|
505 |
-
f"{LOGO_SVG}"
|
506 |
-
"<div><div class='vb-title'>Verbatify — Analyse NPS</div>"
|
507 |
-
"<div class='vb-sub'>Émotions • Thématiques • Occurrences • Synthèse</div></div>"
|
508 |
-
"</div>"
|
509 |
)
|
510 |
|
511 |
-
#
|
512 |
-
|
513 |
-
# Footer => À L’INTÉRIEUR du with Blocks:
|
514 |
gr.HTML(
|
515 |
'<div class="vb-footer">© Verbatify.com — Construit par '
|
516 |
-
'<a href="https://jeremy-lagache.fr/" target="_blank" rel="
|
517 |
)
|
518 |
|
519 |
-
if __name__ == "__main__":
|
520 |
-
demo.launch(share=False, show_api=False) # rien après cette ligne
|
521 |
-
|
522 |
-
|
523 |
if __name__ == "__main__":
|
524 |
demo.launch(share=False, show_api=False)
|
|
|
448 |
|
449 |
# ---------------- UI ----------------
|
450 |
apply_plotly_theme()
|
451 |
+
|
452 |
with gr.Blocks(title="Verbatify — Analyse NPS", css=VB_CSS) as demo:
|
453 |
+
# Header
|
454 |
gr.HTML(
|
455 |
"<div class='vb-hero'>"
|
456 |
f"{LOGO_SVG}"
|
|
|
459 |
"</div>"
|
460 |
)
|
461 |
|
462 |
+
# Inputs
|
463 |
with gr.Column():
|
464 |
+
pasted = gr.Textbox(
|
465 |
+
label="Verbatims (un par ligne)", lines=10,
|
466 |
+
placeholder="Exemple :\nRemboursement rapide, télétransmission OK | 10\nImpossible de joindre un conseiller | 3\nEspace client : bug à la connexion | 4",
|
467 |
+
)
|
468 |
with gr.Row():
|
469 |
has_score = gr.Checkbox(label="J’ai un score NPS par ligne", value=False)
|
470 |
sep = gr.Textbox(label="Séparateur score", value="|", scale=1)
|
|
|
481 |
top_k=gr.Slider(label="Top thèmes (K) pour les graphes", minimum=5, maximum=20, value=10, step=1)
|
482 |
run=gr.Button("Lancer l'analyse", variant="primary")
|
483 |
|
484 |
+
# Panneaux
|
485 |
with gr.Row():
|
486 |
+
ench_panel=gr.Markdown()
|
487 |
+
irr_panel=gr.Markdown()
|
488 |
+
reco_panel=gr.Markdown()
|
489 |
|
490 |
+
# Résultats + téléchargements
|
491 |
+
summary=gr.Markdown(label="Synthèse NPS & ressentis clients")
|
492 |
themes_table=gr.Dataframe(label="Thèmes — statistiques")
|
493 |
enriched_table=gr.Dataframe(label="Verbatims enrichis (aperçu)")
|
494 |
files_out=gr.Files(label="Téléchargements (CSV & ZIP)")
|
495 |
|
496 |
+
# Graphes
|
497 |
with gr.Row():
|
498 |
plot_nps = gr.Plot(label="NPS — Jauge")
|
499 |
plot_sent= gr.Plot(label="Répartition des émotions")
|
|
|
501 |
plot_top = gr.Plot(label="Top thèmes — occurrences")
|
502 |
plot_bal = gr.Plot(label="Top thèmes — balance Pos/Neg")
|
503 |
|
504 |
+
# Lancer
|
505 |
run.click(
|
506 |
analyze_text,
|
507 |
inputs=[pasted, has_score, sep, anon, use_oa_sent, use_oa_themes, use_oa_summary, oa_model, oa_temp, top_k],
|
508 |
+
outputs=[summary, themes_table, enriched_table, files_out,
|
509 |
+
ench_panel, irr_panel, reco_panel,
|
510 |
+
plot_nps, plot_sent, plot_top, plot_bal]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
)
|
512 |
|
513 |
+
# Footer (à l'intérieur du bloc)
|
|
|
|
|
514 |
gr.HTML(
|
515 |
'<div class="vb-footer">© Verbatify.com — Construit par '
|
516 |
+
'<a href="https://jeremy-lagache.fr/" target="_blank" rel="noopener">Jérémy Lagache</a></div>'
|
517 |
)
|
518 |
|
|
|
|
|
|
|
|
|
519 |
if __name__ == "__main__":
|
520 |
demo.launch(share=False, show_api=False)
|