Tbruand
commited on
Commit
·
880f334
1
Parent(s):
669937f
feat(handler): affichage des scores pour le modèle few-shot dans le handler
Browse files- app/handler.py +5 -2
app/handler.py
CHANGED
@@ -6,8 +6,11 @@ few_shot_model = FewShotModel()
|
|
6 |
|
7 |
def predict(text: str, model_type: str = "zero-shot") -> str:
|
8 |
if model_type == "few-shot":
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
else:
|
12 |
results = zero_shot_model.predict(text)
|
13 |
output = "### Résultat de la classification (Zero-Shot) :\n\n"
|
|
|
6 |
|
7 |
def predict(text: str, model_type: str = "zero-shot") -> str:
|
8 |
if model_type == "few-shot":
|
9 |
+
results = few_shot_model.predict(text)
|
10 |
+
output = "### Résultat de la classification (Few-Shot) :\n\n"
|
11 |
+
for label, score in results:
|
12 |
+
output += f"- **{label}** : {score*100:.1f}%\n"
|
13 |
+
return output
|
14 |
else:
|
15 |
results = zero_shot_model.predict(text)
|
16 |
output = "### Résultat de la classification (Zero-Shot) :\n\n"
|