Skip to content

Commit

Permalink
fixed bug with google translate, and gender string won't be appeneded…
Browse files Browse the repository at this point in the history
… if their were no entities found
  • Loading branch information
Bikatr7 committed Jun 15, 2024
1 parent 68c658e commit 4025864
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions modules/common/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ def build_async_requests(model:str) -> list[typing.Coroutine]:
logging_message = "Built Messages: \n\n"

translation_batches_methods = {
method_name: getattr(Translator, f"{method_name}_translation_batches")
for method_name in ["openai", "gemini", "deepl", "google_translate"]
method_name: getattr(Translator, f"{method_name}_translation_batches" if method_name != "google translate" else "google_translate_translation_batches")
for method_name in ["openai", "gemini", "deepl", "google translate"]
}

translation_batches = translation_batches_methods[Translator.TRANSLATION_METHOD]
Expand All @@ -576,7 +576,7 @@ def build_async_requests(model:str) -> list[typing.Coroutine]:
if(Translator.gender_context_insertion):
assert os.path.exists(FileEnsurer.external_translation_genders_path), "There must be a genders.json file in the root Kudasai directory to use gender context insertion."
assumption = list(set(GenderUtil.get_gender_assumption_for_system_prompt(prompt if isinstance(prompt, str) else prompt.content)))
assumption_string = "Additional Information:\nCharacter Genders:\n" + "".join(assumption)
assumption_string = "Additional Information:\nCharacter Genders:\n" + "".join(assumption) if len(assumption) > 0 else ""
instructions = SystemTranslationMessage(content=f"{instructions.content if isinstance(instructions, Message) else instructions}\n{assumption_string}")

logging_message += f"\n------------------------\n{instructions.content if isinstance(instructions, Message) else instructions}\n{prompt if isinstance(prompt, str) else prompt.content}"
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
backoff==2.2.1
gradio==4.20.0
kairyou==1.6.3
easytl==0.4.0
kairyou==1.6.4
easytl==0.4.3

0 comments on commit 4025864

Please sign in to comment.