Yaron Koresh commited on
Commit
887de96
·
verified ·
1 Parent(s): 7c558a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -144,8 +144,8 @@ def translate(text,lang):
144
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15',
145
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15'
146
  ]
147
- padded_chars = re.sub("(^-)|(-$)","",text.replace("","-").replace("- -"," ")).strip()
148
- query_text = f'Please translate {padded_chars}, into {lang}'
149
  url = f'https://www.google.com/search?q={query_text}'
150
  print(url)
151
  content = str(requests.get(
 
144
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15',
145
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15'
146
  ]
147
+ text = text.strip()
148
+ query_text = f'Please translate {text}, into {lang}'
149
  url = f'https://www.google.com/search?q={query_text}'
150
  print(url)
151
  content = str(requests.get(