Tbruand
commited on
Commit
·
ec826f2
1
Parent(s):
7301ed6
feat(interface): affiche le score de confiance dans le résultat Gradio
Browse files- app/interface.py +8 -3
app/interface.py
CHANGED
@@ -1,12 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
-
from app.handler import predict
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
def launch_app():
|
5 |
iface = gr.Interface(
|
6 |
fn=predict,
|
7 |
inputs="text",
|
8 |
-
outputs="
|
9 |
title="🧪 ToxiCheck",
|
10 |
-
description="Entrez un texte pour détecter s'il est toxique."
|
11 |
)
|
12 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from app.handler import predict, model
|
3 |
+
|
4 |
+
def predict(text: str) -> str:
|
5 |
+
label, score = model.predict(text)
|
6 |
+
return f"{label} ({score*100:.1f}%)"
|
7 |
+
|
8 |
|
9 |
def launch_app():
|
10 |
iface = gr.Interface(
|
11 |
fn=predict,
|
12 |
inputs="text",
|
13 |
+
outputs="text",
|
14 |
title="🧪 ToxiCheck",
|
15 |
+
description="Entrez un texte pour détecter s'il est toxique. Résultat avec score de confiance."
|
16 |
)
|
17 |
iface.launch()
|