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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -147,6 +147,7 @@ def translate(text,lang):
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
  content = str(requests.get(
151
  url = url,
152
  headers = {
@@ -161,6 +162,7 @@ def translate(text,lang):
161
  if trgt_lang == lang:
162
  translated = trgt_text
163
  ret = re.sub(f'[{punctuation}]', '', re.sub('[ ]+', ' ', translated)).lower().strip()
 
164
  return ret
165
 
166
  def generate_random_string(length):
 
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(
152
  url = url,
153
  headers = {
 
162
  if trgt_lang == lang:
163
  translated = trgt_text
164
  ret = re.sub(f'[{punctuation}]', '', re.sub('[ ]+', ' ', translated)).lower().strip()
165
+ print(ret)
166
  return ret
167
 
168
  def generate_random_string(length):