Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -68,13 +68,13 @@ def translate(text,lang):
|
|
68 |
translated = text
|
69 |
|
70 |
try:
|
71 |
-
src_lang = html.xpath('//span[@class="source-language"]
|
72 |
trgt_lang = html.xpath('//span[@class="target-language"]')[0].text_content().strip()
|
73 |
src_text = html.xpath('//pre[@id="tw-source-text"]/span')[0].text_content().strip()
|
74 |
trgt_text = html.xpath('//pre[@id="tw-target-text"]/span')[0].text_content().strip()
|
75 |
|
76 |
if trgt_lang.lower() == lang.lower():
|
77 |
-
translated =
|
78 |
except:
|
79 |
raise Exception("Translation Error!")
|
80 |
|
|
|
68 |
translated = text
|
69 |
|
70 |
try:
|
71 |
+
src_lang = html.xpath('//span[@class="source-language"]')[0].text_content().strip()
|
72 |
trgt_lang = html.xpath('//span[@class="target-language"]')[0].text_content().strip()
|
73 |
src_text = html.xpath('//pre[@id="tw-source-text"]/span')[0].text_content().strip()
|
74 |
trgt_text = html.xpath('//pre[@id="tw-target-text"]/span')[0].text_content().strip()
|
75 |
|
76 |
if trgt_lang.lower() == lang.lower():
|
77 |
+
translated = trgt_text
|
78 |
except:
|
79 |
raise Exception("Translation Error!")
|
80 |
|