Spaces:
Sleeping
Sleeping
lixiang46
commited on
Commit
•
3976754
1
Parent(s):
f228b92
add proxy
Browse files
app.py
CHANGED
@@ -25,6 +25,7 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
|
|
25 |
token = os.environ['token']
|
26 |
cookie = os.environ['Cookie']
|
27 |
referer = os.environ['referer']
|
|
|
28 |
|
29 |
headers = {'Content-Type': 'application/json', 'token': token, 'Cookie': cookie, 'referer': referer}
|
30 |
data = {
|
@@ -36,6 +37,7 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
|
|
36 |
result_img = None
|
37 |
try:
|
38 |
session = requests.Session()
|
|
|
39 |
response = session.post(url, headers=headers, data=json.dumps(data), timeout=60)
|
40 |
print("response code", response.status_code)
|
41 |
if response.status_code == 200:
|
|
|
25 |
token = os.environ['token']
|
26 |
cookie = os.environ['Cookie']
|
27 |
referer = os.environ['referer']
|
28 |
+
http_proxy = os.environ['http_proxy']
|
29 |
|
30 |
headers = {'Content-Type': 'application/json', 'token': token, 'Cookie': cookie, 'referer': referer}
|
31 |
data = {
|
|
|
37 |
result_img = None
|
38 |
try:
|
39 |
session = requests.Session()
|
40 |
+
session.proxies = {"http": http_proxy}
|
41 |
response = session.post(url, headers=headers, data=json.dumps(data), timeout=60)
|
42 |
print("response code", response.status_code)
|
43 |
if response.status_code == 200:
|