Neprox commited on
Commit
3ab9658
1 Parent(s): 466d654

try other translator

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ from moviepy.editor import AudioFileClip
8
  # import googletrans # googletrans api
9
  # from googletrans import Translator # googletrans api
10
  # from google_trans_new import google_translator # google_trans_new api
11
- from deep_translator import MicrosoftTranslator # GoogleTranslator
12
 
13
  pipe = pipeline(model="Neprox/model")
14
  # translator = google_translator() # google_trans_new api
@@ -90,7 +90,7 @@ def get_translation(text, target_lang="English (en)"):
90
  Translates the given Swedish text to the language specified.
91
  """
92
  lang_code = target_lang.split(" ")[-1][1:-1]
93
- return MicrosoftTranslator(source='sv', target=lang_code).translate(text)
94
  # return translator.translate(text, lang_tgt=lang_code) # googletrans_new api
95
  # result = translator.translate(text, lang_code, 'sv') # googletrans api
96
  # return result.text # googletrans api
 
8
  # import googletrans # googletrans api
9
  # from googletrans import Translator # googletrans api
10
  # from google_trans_new import google_translator # google_trans_new api
11
+ from deep_translator import GoogleTranslator # MicrosoftTranslator
12
 
13
  pipe = pipeline(model="Neprox/model")
14
  # translator = google_translator() # google_trans_new api
 
90
  Translates the given Swedish text to the language specified.
91
  """
92
  lang_code = target_lang.split(" ")[-1][1:-1]
93
+ return GoogleTranslator(source='sv', target=lang_code).translate(text)
94
  # return translator.translate(text, lang_tgt=lang_code) # googletrans_new api
95
  # result = translator.translate(text, lang_code, 'sv') # googletrans api
96
  # return result.text # googletrans api