DebasishDhal99 commited on
Commit
b3a11ad
1 Parent(s): 07b5fef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -12,12 +12,17 @@ import string
12
  import re
13
  from deep_translator import GoogleTranslator
14
 
 
 
 
 
 
 
15
  def random_sentence(lang):
16
  gen = DocumentGenerator()
17
- translator = Translator()
18
- sentence=gen.sentence() #Generates a random but coherent sentence in English
19
- return str(translator.translate(sentence,dest=lang).text) #Translates the sentence to target language
20
-
21
 
22
  tab1, tab2, tab3, tab4, tab5= st.tabs(["Polish/Polski", "Hungarian/Magyar", "Turkish/Türkçe", "Serbo-Croatian-Bosnian", "Romanian"])
23
  # tab1, tab3, tab4= st.tabs(["Polish/Polski", "Turkish/Türkçe", "Serbo-Croatian-Bosnian"])
 
12
  import re
13
  from deep_translator import GoogleTranslator
14
 
15
+ # def random_sentence(lang):
16
+ # gen = DocumentGenerator()
17
+ # translator = Translator()
18
+ # sentence=gen.sentence() #Generates a random but coherent sentence in English
19
+ # return str(translator.translate(sentence,dest=lang).text) #Translates the sentence to target language
20
+
21
  def random_sentence(lang):
22
  gen = DocumentGenerator()
23
+ sentence = gen.sentence() # Generates a random sentence in English
24
+ translated = GoogleTranslator(source='en', target=lang).translate(sentence)
25
+ return translated
 
26
 
27
  tab1, tab2, tab3, tab4, tab5= st.tabs(["Polish/Polski", "Hungarian/Magyar", "Turkish/Türkçe", "Serbo-Croatian-Bosnian", "Romanian"])
28
  # tab1, tab3, tab4= st.tabs(["Polish/Polski", "Turkish/Türkçe", "Serbo-Croatian-Bosnian"])