lixiang46 commited on
Commit
b470d34
1 Parent(s): 5b58307
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -64,6 +64,8 @@ def tryon(person_img, garment_img, seed, randomize_seed):
64
  result_img = cv2.cvtColor(result_img, cv2.COLOR_RGB2BGR)
65
  info = "Success"
66
  break
 
 
67
  else:
68
  print(response.text)
69
  info = "URL error, pleace contact the admin"
@@ -227,8 +229,8 @@ with gr.Blocks(css=css) as Tryon:
227
  with gr.Row():
228
  seed_used = gr.Number(label="Seed used")
229
  result_info = gr.Text(label="Response")
230
- try_button = gr.Button(value="Run", elem_id="button")
231
- test_button = gr.Button(value="Test", elem_id="button")
232
 
233
 
234
  try_button.click(fn=start_tryon, inputs=[imgs, garm_img, seed, randomize_seed], outputs=[image_out, seed_used, result_info], api_name='tryon',concurrency_limit=10)
 
64
  result_img = cv2.cvtColor(result_img, cv2.COLOR_RGB2BGR)
65
  info = "Success"
66
  break
67
+ elif status == "error":
68
+ raise gr.Error("Too many users, please try again later")
69
  else:
70
  print(response.text)
71
  info = "URL error, pleace contact the admin"
 
229
  with gr.Row():
230
  seed_used = gr.Number(label="Seed used")
231
  result_info = gr.Text(label="Response")
232
+ # try_button = gr.Button(value="Run", elem_id="button")
233
+ test_button = gr.Button(value="Run", elem_id="button")
234
 
235
 
236
  try_button.click(fn=start_tryon, inputs=[imgs, garm_img, seed, randomize_seed], outputs=[image_out, seed_used, result_info], api_name='tryon',concurrency_limit=10)