Skip to content

Commit

Permalink
fix: add skip condition for translator
Browse files Browse the repository at this point in the history
  • Loading branch information
wenhwang97 committed Apr 30, 2024
1 parent f2bbca9 commit 69be44e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions translator/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def translate():
for record in res.json().get("list"):
for key in record.keys():
if key in target_field.keys():
if not record.get(key):
continue
sample_text = record.get(key).strip()[:100]
language = translator_instance.detect_lang_google(sample_text)
if language != "en" and language != "und":
Expand Down

0 comments on commit 69be44e

Please sign in to comment.