lixiang46 commited on
Commit
4284d10
1 Parent(s): b24f193
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -45,14 +45,13 @@ def tryon(person_img, garment_img, seed, randomize_seed):
45
  post_end_time = time.time()
46
  print(f"time used: {post_end_time-post_start_time}")
47
 
48
- time.sleep(10)
49
  get_start_time =time.time()
 
50
  Max_Retry = 10
51
  for i in range(Max_Retry):
52
- time.sleep(3)
53
  try:
54
  url = "http://" + os.environ['tryon_url'] + "Query?taskId=" + uuid
55
- response = requests.get(url, headers=headers, timeout=10)
56
  print("get response code", response.status_code)
57
  print(response.text)
58
  if response.status_code == 200:
@@ -71,6 +70,7 @@ def tryon(person_img, garment_img, seed, randomize_seed):
71
  except requests.exceptions.ReadTimeout:
72
  print("timeout")
73
  info = "Too many users, please try again later"
 
74
  get_end_time = time.time()
75
  print(f"time used: {get_end_time-get_start_time}")
76
 
 
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(10)
50
  Max_Retry = 10
51
  for i in range(Max_Retry):
 
52
  try:
53
  url = "http://" + os.environ['tryon_url'] + "Query?taskId=" + uuid
54
+ response = requests.get(url, headers=headers, timeout=15)
55
  print("get response code", response.status_code)
56
  print(response.text)
57
  if response.status_code == 200:
 
70
  except requests.exceptions.ReadTimeout:
71
  print("timeout")
72
  info = "Too many users, please try again later"
73
+ time.sleep(1)
74
  get_end_time = time.time()
75
  print(f"time used: {get_end_time-get_start_time}")
76