Spaces:
Paused
Paused
lixiang46
commited on
Commit
•
8d83455
1
Parent(s):
f24d75a
add error log
Browse files
app.py
CHANGED
@@ -50,6 +50,7 @@ def tryon(person_img, garment_img, seed, randomize_seed):
|
|
50 |
Max_Retry = 10
|
51 |
result_img = None
|
52 |
info = ""
|
|
|
53 |
for i in range(Max_Retry):
|
54 |
try:
|
55 |
url = "http://" + os.environ['tryon_url'] + "Query?taskId=" + uuid
|
@@ -66,23 +67,26 @@ def tryon(person_img, garment_img, seed, randomize_seed):
|
|
66 |
info = "Success"
|
67 |
break
|
68 |
elif status == "error":
|
69 |
-
|
70 |
-
raise gr.Error("Too many users, please try again later")
|
71 |
else:
|
72 |
-
print(response.text)
|
|
|
73 |
info = "URL error, pleace contact the admin"
|
74 |
except requests.exceptions.ReadTimeout:
|
75 |
-
|
76 |
info = "Too many users, please try again later"
|
77 |
except Exception as err:
|
78 |
-
|
79 |
time.sleep(1)
|
80 |
get_end_time = time.time()
|
81 |
print(f"get time used: {get_end_time-get_start_time}")
|
82 |
print(f"all time used: {get_end_time-get_start_time+post_end_time-post_start_time}")
|
83 |
if info == "":
|
84 |
-
|
85 |
info = "Too many users, please try again later"
|
|
|
|
|
|
|
86 |
|
87 |
return result_img, seed, info
|
88 |
|
|
|
50 |
Max_Retry = 10
|
51 |
result_img = None
|
52 |
info = ""
|
53 |
+
err_log = ""
|
54 |
for i in range(Max_Retry):
|
55 |
try:
|
56 |
url = "http://" + os.environ['tryon_url'] + "Query?taskId=" + uuid
|
|
|
67 |
info = "Success"
|
68 |
break
|
69 |
elif status == "error":
|
70 |
+
err_log = f"Status is Error"
|
|
|
71 |
else:
|
72 |
+
# print(response.text)
|
73 |
+
err_log = "URL error, pleace contact the admin"
|
74 |
info = "URL error, pleace contact the admin"
|
75 |
except requests.exceptions.ReadTimeout:
|
76 |
+
err_log = "Http Timeout"
|
77 |
info = "Too many users, please try again later"
|
78 |
except Exception as err:
|
79 |
+
err_log = f"Get Exception Error: {err}"
|
80 |
time.sleep(1)
|
81 |
get_end_time = time.time()
|
82 |
print(f"get time used: {get_end_time-get_start_time}")
|
83 |
print(f"all time used: {get_end_time-get_start_time+post_end_time-post_start_time}")
|
84 |
if info == "":
|
85 |
+
err_log = f"No image after {Max_Retry} retries"
|
86 |
info = "Too many users, please try again later"
|
87 |
+
if info != "Success":
|
88 |
+
print(f"Error Log: {err_log}")
|
89 |
+
raise gr.Error("Too many users, please try again later")
|
90 |
|
91 |
return result_img, seed, info
|
92 |
|