selfitcamera commited on
Commit
b734a17
1 Parent(s): 2105e3c
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -63,11 +63,9 @@ def onLoad(request: gr.Request):
63
  if x_forwarded_for:
64
  client_ip = x_forwarded_for
65
  his_datas = [None for _ in range(10)]
66
- msg = "no finished tasks found"
67
  try:
68
  infs = getAllInfs(ApiUrl, OpenId, ApiKey, client_ip)
69
  print(client_ip, 'history infs: ', len(infs))
70
- msg = f'You have {len(infs)} finished tasks, see history tab for detail',
71
  for i, inf in enumerate(infs):
72
  if i>4: continue
73
  his_datas[i*2] = inf['pose']
@@ -75,8 +73,7 @@ def onLoad(request: gr.Request):
75
  time.sleep(3)
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()
@@ -126,7 +123,7 @@ with gr.Blocks(css=css) as demo:
126
  examples_per_page=3,
127
  examples=pose_examples)
128
  size_slider = gr.Slider(-2.5, 2.5, value=1, interactive=True, label="clothes size")
129
-
130
  with gr.Column():
131
  with gr.Column():
132
  run_button = gr.Button(value="Run")
@@ -165,7 +162,7 @@ with gr.Blocks(css=css) as demo:
165
  demo.load(onLoad, inputs=[], outputs=[his_pose_image1, his_res_image1,
166
  his_pose_image2, his_res_image2, his_pose_image3, his_res_image3,
167
  his_pose_image4, his_res_image4, his_pose_image5, his_res_image5,
168
- info_text])
169
 
170
  if __name__ == "__main__":
171
 
 
63
  if x_forwarded_for:
64
  client_ip = x_forwarded_for
65
  his_datas = [None for _ in range(10)]
 
66
  try:
67
  infs = getAllInfs(ApiUrl, OpenId, ApiKey, client_ip)
68
  print(client_ip, 'history infs: ', len(infs))
 
69
  for i, inf in enumerate(infs):
70
  if i>4: continue
71
  his_datas[i*2] = inf['pose']
 
73
  time.sleep(3)
74
  except Exception as e:
75
  print(e)
76
+ return his_datas
 
77
 
78
 
79
  cloth_examples = get_cloth_examples()
 
123
  examples_per_page=3,
124
  examples=pose_examples)
125
  size_slider = gr.Slider(-2.5, 2.5, value=1, interactive=True, label="clothes size")
126
+
127
  with gr.Column():
128
  with gr.Column():
129
  run_button = gr.Button(value="Run")
 
162
  demo.load(onLoad, inputs=[], outputs=[his_pose_image1, his_res_image1,
163
  his_pose_image2, his_res_image2, his_pose_image3, his_res_image3,
164
  his_pose_image4, his_res_image4, his_pose_image5, his_res_image5,
165
+ ])
166
 
167
  if __name__ == "__main__":
168