From c41e3b26ec6880e5d7667c093c496ccbbd70a15b Mon Sep 17 00:00:00 2001 From: gbrielgustavo <31826442+gbrielgustavo@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:46:43 -0300 Subject: [PATCH] Translates non-english labels Translates non-english captcha labels to english, so captchas in non-english languages can be solved --- recognizer/components/detector.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recognizer/components/detector.py b/recognizer/components/detector.py index 2f99786..16188b6 100644 --- a/recognizer/components/detector.py +++ b/recognizer/components/detector.py @@ -20,6 +20,7 @@ warnings.filterwarnings("ignore", category=UserWarning, message="TypedStorage is deprecated") +from deep_translator import GoogleTranslator class DetectionModels: def __init__(self) -> None: @@ -291,6 +292,7 @@ def detect( # Making best guess if its area_captcha if user did not specify area_captcha = "square" in prompt if area_captcha is None else area_captcha label = split_prompt_message(prompt) + label = GoogleTranslator(source='auto', target='en').translate(label) if label not in self.challenge_alias: print(f"[ERROR] Types of challenges of label {label} not yet scheduled (Prompt: {prompt}).")