Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
fix: core translation conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
dsdanielpark committed Dec 27, 2023
1 parent 04496f6 commit ddf4c22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bardapi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ def get_answer(
source="auto", target=self.language
).translate
else:

def translator_func(text):
return google_official_translator(
text, target_language=self.language
Expand Down Expand Up @@ -748,7 +747,9 @@ def ask_about_image(
parsed_answer = json.loads(resp_dict)
content = parsed_answer[4][0][1][0]
try:
if self.language is not None and self.google_translator_api_key is None:
if self.language is None and self.google_translator_api_key is None:
translated_content = content
elif self.language is not None and self.google_translator_api_key is None:
translator = GoogleTranslator(source="en", target=self.language)
translated_content = translator.translate(content)

Expand Down

0 comments on commit ddf4c22

Please sign in to comment.