Spaces:
Runtime error
Runtime error
lixiang46
commited on
Commit
•
5b58307
1
Parent(s):
24f237b
update
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ def tryon(person_img, garment_img, seed, randomize_seed):
|
|
32 |
"seed": seed
|
33 |
}
|
34 |
try:
|
35 |
-
response = requests.post(url, headers=headers, data=json.dumps(data), timeout=
|
36 |
print("post response code", response.status_code)
|
37 |
if response.status_code == 200:
|
38 |
result = response.json()['result']
|
@@ -40,10 +40,11 @@ def tryon(person_img, garment_img, seed, randomize_seed):
|
|
40 |
if status == "success":
|
41 |
uuid = result['result']
|
42 |
print(uuid)
|
43 |
-
|
44 |
-
|
|
|
45 |
post_end_time = time.time()
|
46 |
-
print(f"time used: {post_end_time-post_start_time}")
|
47 |
|
48 |
get_start_time =time.time()
|
49 |
time.sleep(9)
|
@@ -71,7 +72,7 @@ def tryon(person_img, garment_img, seed, randomize_seed):
|
|
71 |
info = "Too many users, please try again later"
|
72 |
time.sleep(1)
|
73 |
get_end_time = time.time()
|
74 |
-
print(f"time used: {get_end_time-get_start_time}")
|
75 |
|
76 |
return result_img, seed, info
|
77 |
|
|
|
32 |
"seed": seed
|
33 |
}
|
34 |
try:
|
35 |
+
response = requests.post(url, headers=headers, data=json.dumps(data), timeout=50)
|
36 |
print("post response code", response.status_code)
|
37 |
if response.status_code == 200:
|
38 |
result = response.json()['result']
|
|
|
40 |
if status == "success":
|
41 |
uuid = result['result']
|
42 |
print(uuid)
|
43 |
+
except requests.exceptions.ReadTimeout:
|
44 |
+
print("post timeout")
|
45 |
+
raise gr.Error("Too many users, please try again later")
|
46 |
post_end_time = time.time()
|
47 |
+
print(f"post time used: {post_end_time-post_start_time}")
|
48 |
|
49 |
get_start_time =time.time()
|
50 |
time.sleep(9)
|
|
|
72 |
info = "Too many users, please try again later"
|
73 |
time.sleep(1)
|
74 |
get_end_time = time.time()
|
75 |
+
print(f"get time used: {get_end_time-get_start_time}")
|
76 |
|
77 |
return result_img, seed, info
|
78 |
|