Chandrabhan01 commited on
Commit
0aaf2f9
·
1 Parent(s): ea652b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,6 +1,6 @@
1
  from gtts import gTTS
2
  import gradio as gr
3
- from googletrans import Translator
4
 
5
  lang = {'Afrikaans': 'af','Arabic':'ar','Bulgarian':'bg','Bengali':'bn','Bosnian':'bs',
6
  'Catalan':'ca','Czech':'cs','Danish':'da','German':'de','Greek':'el','English':'en',
@@ -23,9 +23,8 @@ tld = {'English(Australia)':'com.au', 'English (United Kingdom)':'co.uk',
23
  'Spanish (Mexico)':'com.mx','Spanish (Spain)':'es','Spanish (United States)':'us'}
24
 
25
  def T2TConversion(sentence, language):
26
- translator = Translator()
27
- translation = translator.translate(sentence, dest = lang[language])
28
- return translation.text
29
 
30
  def convert_text(Text, Accent):
31
  """ Performs Text-To-Speech provided language and accent.] """
 
1
  from gtts import gTTS
2
  import gradio as gr
3
+ import mtranslate
4
 
5
  lang = {'Afrikaans': 'af','Arabic':'ar','Bulgarian':'bg','Bengali':'bn','Bosnian':'bs',
6
  'Catalan':'ca','Czech':'cs','Danish':'da','German':'de','Greek':'el','English':'en',
 
23
  'Spanish (Mexico)':'com.mx','Spanish (Spain)':'es','Spanish (United States)':'us'}
24
 
25
  def T2TConversion(sentence, language):
26
+ translated_text = mtranslate.translate(sentence, lang[language])
27
+ return translated_text
 
28
 
29
  def convert_text(Text, Accent):
30
  """ Performs Text-To-Speech provided language and accent.] """