diff --git a/app/main.py b/app/main.py index da303a2..db9cc45 100644 --- a/app/main.py +++ b/app/main.py @@ -129,6 +129,7 @@ class Config: l'activité principale \ de l'entreprise (APE)", version="0.0.1", + # root_path="/app", ) @@ -249,6 +250,7 @@ async def predict_and_explain( pred, confidence, all_scores = model.predict_and_explain(text, params) response = process_response_explain( + text=text, predictions=pred, liasse_nb=0, confidence=confidence, diff --git a/app/utils.py b/app/utils.py index d16bd0d..2f89c16 100644 --- a/app/utils.py +++ b/app/utils.py @@ -305,6 +305,7 @@ def process_response( def process_response_explain( + text: list[str], predictions: list[list[str]], liasse_nb: int, confidence: list[list[float]], @@ -341,8 +342,8 @@ def process_response_explain( "libelle": libs[predictions[liasse_nb][-1].replace("__label__", "")], } } - for word in list(all_scores[liasse_nb].keys()): - output_dict[word] = all_scores[liasse_nb][word] + + output_dict[text[liasse_nb]] = all_scores[liasse_nb] try: response = output_dict