Skip to content
This repository has been archived by the owner on Oct 15, 2023. It is now read-only.

Commit

Permalink
update models
Browse files Browse the repository at this point in the history
  • Loading branch information
blazinghorizon committed Oct 15, 2023
1 parent d4b3ac0 commit a1c64b3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions model/preprocessor/libs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
from datetime import timedelta
import random
import re

import requests
from PIL import Image
Expand Down Expand Up @@ -58,11 +59,14 @@ def translate(self, text: str) -> str:
# if check_profanity_ru(text):
# return ''
try:
text = argostranslate.translate.translate(text, self.from_code, self.to_code)
new_text = argostranslate.translate.translate(text, self.from_code, self.to_code)
if re.search(new_text, r'[A-Za-z]') is None:
return text
except:
logger.error(f'Ошибка при переводе текста: {text}')
return text

return text
return new_text

class VideoParser:

Expand Down

0 comments on commit a1c64b3

Please sign in to comment.