selfitcamera commited on
Commit
f4de1ae
1 Parent(s): 25f6323
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -64,16 +64,19 @@ def onLoad(request: gr.Request):
64
  if x_forwarded_for:
65
  client_ip = x_forwarded_for
66
  his_datas = [None for _ in range(10)]
 
67
  try:
68
  infs = getAllInfs(ApiUrl, OpenId, ApiKey, client_ip)
69
- print(client_ip, 'infs', len(infs), infs)
 
70
  for i, inf in enumerate(infs):
71
  if i>4: continue
72
  his_datas[i*2] = inf['pose']
73
  his_datas[i*2+1] = inf['res']
74
  except Exception as e:
75
  print(e)
76
- return his_datas
 
77
 
78
 
79
  cloth_examples = get_cloth_examples()
@@ -158,7 +161,7 @@ with gr.Blocks(css=css) as demo:
158
  demo.load(onLoad, inputs=[], outputs=[his_pose_image1, his_res_image1,
159
  his_pose_image2, his_res_image2, his_pose_image3, his_res_image3,
160
  his_pose_image4, his_res_image4, his_pose_image5, his_res_image5,
161
- ])
162
 
163
  if __name__ == "__main__":
164
 
 
64
  if x_forwarded_for:
65
  client_ip = x_forwarded_for
66
  his_datas = [None for _ in range(10)]
67
+ msg = "no finished tasks found"
68
  try:
69
  infs = getAllInfs(ApiUrl, OpenId, ApiKey, client_ip)
70
+ print(client_ip, 'history infs: ', len(infs))
71
+ msg = f'You have {len(infs)} finished tasks, see history tab for detail',
72
  for i, inf in enumerate(infs):
73
  if i>4: continue
74
  his_datas[i*2] = inf['pose']
75
  his_datas[i*2+1] = inf['res']
76
  except Exception as e:
77
  print(e)
78
+ msg = str(e)
79
+ return his_datas+[msg]
80
 
81
 
82
  cloth_examples = get_cloth_examples()
 
161
  demo.load(onLoad, inputs=[], outputs=[his_pose_image1, his_res_image1,
162
  his_pose_image2, his_res_image2, his_pose_image3, his_res_image3,
163
  his_pose_image4, his_res_image4, his_pose_image5, his_res_image5,
164
+ info_text])
165
 
166
  if __name__ == "__main__":
167