Skip to content

Commit

Permalink
Add logs in retranslate
Browse files Browse the repository at this point in the history
  • Loading branch information
Shruti1229 committed Jul 27, 2023
1 parent 25bb5ad commit f1dba3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/translation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def get_batch_translations_using_indictrans_nmt_api(
Returns:
list: List of dictionaries containing the translated sentences.
"""

# Convert language code to language text
source_language_name = LANG_CODE_TO_NAME[source_language]
target_language_name = LANG_CODE_TO_NAME[target_language]
Expand Down Expand Up @@ -195,6 +194,7 @@ def get_batch_translations_using_indictrans_nmt_api(
# Collect the translated sentences
return [translation["target"] for translation in translations_output]
except Exception as e:
logging.info("Error in generating translation Output")
return str(e)


Expand Down
4 changes: 3 additions & 1 deletion backend/translation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ def generate_translation_output(request):
status=status.HTTP_400_BAD_REQUEST,
)

logging.info("Generating Translation for task_id %s", str(task_id))
user = request.user

try:
Expand Down Expand Up @@ -924,7 +925,8 @@ def modify_payload(limit, payload, start_offset, end_offset, translation):
translation.video.language,
translation.task.target_language,
)
payload["payload"][i]["target_text"] = translated_text[0]
if type(translated_text) == list:
payload["payload"][i]["target_text"] = translated_text[0]
if len(payload["payload"]) == limit:
length = len(payload["payload"])
length_2 = -1
Expand Down

0 comments on commit f1dba3d

Please sign in to comment.