Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ else:
|
|
27 |
def translate(text,lang):
|
28 |
html_str = requests.get( url = "https://translate.google.com", params = {"sl": "auto", "tl": lang, "op": "translate", "text": text} ).text
|
29 |
tree = fromstring(html_str)
|
30 |
-
translated = tree.xpath('span[lang="'+lang+'"]/span/span/text()')[0]
|
31 |
return translated
|
32 |
|
33 |
def generate_random_string(length):
|
|
|
27 |
def translate(text,lang):
|
28 |
html_str = requests.get( url = "https://translate.google.com", params = {"sl": "auto", "tl": lang, "op": "translate", "text": text} ).text
|
29 |
tree = fromstring(html_str)
|
30 |
+
translated = tree.xpath('//span[@lang="'+lang+'"]/span/span/text()')[0]
|
31 |
return translated
|
32 |
|
33 |
def generate_random_string(length):
|