DebasishDhal99
commited on
Commit
·
0302af3
1
Parent(s):
89415ca
Putting the generation and translation imports inside translate function
Browse files
app.py
CHANGED
@@ -41,10 +41,10 @@ from googletrans import Translator
|
|
41 |
import re
|
42 |
from nltk.tokenize import word_tokenize
|
43 |
|
44 |
-
gen = DocumentGenerator()
|
45 |
-
translator = Translator()
|
46 |
|
47 |
def random_sentence(lang):
|
|
|
|
|
48 |
sentence=gen.sentence() #Generates a random but coherent sentence in English
|
49 |
return str(translator.translate(sentence,dest=lang).text) #Translates the sentence to target language
|
50 |
|
|
|
41 |
import re
|
42 |
from nltk.tokenize import word_tokenize
|
43 |
|
|
|
|
|
44 |
|
45 |
def random_sentence(lang):
|
46 |
+
gen = DocumentGenerator()
|
47 |
+
translator = Translator()
|
48 |
sentence=gen.sentence() #Generates a random but coherent sentence in English
|
49 |
return str(translator.translate(sentence,dest=lang).text) #Translates the sentence to target language
|
50 |
|