Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,6 @@ import torch
|
|
11 |
from pathos.multiprocessing import ProcessingPool as ProcessPoolExecutor
|
12 |
import requests
|
13 |
from lxml.html import fromstring
|
14 |
-
from urllib import parse
|
15 |
|
16 |
pool = ProcessPoolExecutor(4)
|
17 |
pool.__enter__()
|
@@ -40,10 +39,11 @@ def translate(text,lang):
|
|
40 |
'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',
|
41 |
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15'
|
42 |
]
|
43 |
-
url =
|
44 |
print(url)
|
45 |
resp = requests.get(
|
46 |
url = url,
|
|
|
47 |
headers = {
|
48 |
'User-Agent': random.choice(user_agents)
|
49 |
}
|
|
|
11 |
from pathos.multiprocessing import ProcessingPool as ProcessPoolExecutor
|
12 |
import requests
|
13 |
from lxml.html import fromstring
|
|
|
14 |
|
15 |
pool = ProcessPoolExecutor(4)
|
16 |
pool.__enter__()
|
|
|
39 |
'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',
|
40 |
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15'
|
41 |
]
|
42 |
+
url = 'https://www.google.com/search'
|
43 |
print(url)
|
44 |
resp = requests.get(
|
45 |
url = url,
|
46 |
+
params = {'q': f'{lang}: {text}'},
|
47 |
headers = {
|
48 |
'User-Agent': random.choice(user_agents)
|
49 |
}
|