Yaron Koresh commited on
Commit
544df84
·
verified ·
1 Parent(s): 369a3fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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"]/span')[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 = rslt
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