Spaces:
Running
Running
adjust api call
Browse files
app.py
CHANGED
@@ -120,10 +120,10 @@ def run_turbo(person_img, garm_img, category="Top"):
|
|
120 |
|
121 |
job_id, status = call_tryon_api(person_img, garm_img, category, model_type= os.environ['MODEL_TYPE'])
|
122 |
|
123 |
-
time.sleep(
|
124 |
|
125 |
# check the status of the job
|
126 |
-
max_retry =
|
127 |
while status not in ["completed", "failed"]:
|
128 |
try:
|
129 |
result_image_url, status = get_tryon_result(job_id)
|
@@ -131,7 +131,7 @@ def run_turbo(person_img, garm_img, category="Top"):
|
|
131 |
return result_image_url, info
|
132 |
except:
|
133 |
pass
|
134 |
-
time.sleep(
|
135 |
|
136 |
gr.Warning("Over heated, please try again later")
|
137 |
return None, info
|
|
|
120 |
|
121 |
job_id, status = call_tryon_api(person_img, garm_img, category, model_type= os.environ['MODEL_TYPE'])
|
122 |
|
123 |
+
time.sleep(8) # wait before fetching the result
|
124 |
|
125 |
# check the status of the job
|
126 |
+
max_retry = 40 # 40x1.5s = 60s timeout for sinlge job run
|
127 |
while status not in ["completed", "failed"]:
|
128 |
try:
|
129 |
result_image_url, status = get_tryon_result(job_id)
|
|
|
131 |
return result_image_url, info
|
132 |
except:
|
133 |
pass
|
134 |
+
time.sleep(1.5) # Wait before retrying
|
135 |
|
136 |
gr.Warning("Over heated, please try again later")
|
137 |
return None, info
|