selfitcamera commited on
Commit
341af28
1 Parent(s): 0371bab
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -15,6 +15,7 @@ def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
15
  res = get_result_example(cloth_id, pose_id)
16
  print(res)
17
  assert os.path.exists(res), res
 
18
  return res, "Done! Use the pre-run results directly, the cloth size does not take effect "
19
  else:
20
  try:
@@ -65,7 +66,7 @@ def onLoad(request: gr.Request):
65
  try:
66
  infs = getAllInfs(ApiUrl, OpenId, ApiKey, client_ip)
67
  print(client_ip, 'history infs: ', len(infs))
68
- print(infs)
69
 
70
  for i, inf in enumerate(infs):
71
  if i>4: continue
@@ -73,7 +74,6 @@ def onLoad(request: gr.Request):
73
  res = inf['res']
74
  # his_datas[i*2] = f"[pose]({pose})"+f"![pose]({pose})"
75
  # his_datas[i*2+1] = f"[res]({res})"+f"![res]({res})"
76
-
77
  his_datas[i*2] = f"<img src=\"{pose}\" >"
78
  his_datas[i*2+1] = f"<img src=\"{res}\" >"
79
 
@@ -134,7 +134,8 @@ with gr.Blocks(css=css) as demo:
134
  with gr.Column():
135
  run_button = gr.Button(value="Run")
136
  init_res = get_result_example(cloth_examples[0][0], pose_examples[0][0])
137
- res_image = gr.Image(label="result image", value=None, type="filepath")
 
138
  # res_image = gr.Image(label="result image", value=cv2.imread(init_res),
139
  # type="numpy")
140
  info_text = gr.Textbox(value="", interactive=False,
 
15
  res = get_result_example(cloth_id, pose_id)
16
  print(res)
17
  assert os.path.exists(res), res
18
+ res = cv2.imread(res)
19
  return res, "Done! Use the pre-run results directly, the cloth size does not take effect "
20
  else:
21
  try:
 
66
  try:
67
  infs = getAllInfs(ApiUrl, OpenId, ApiKey, client_ip)
68
  print(client_ip, 'history infs: ', len(infs))
69
+ # print(infs)
70
 
71
  for i, inf in enumerate(infs):
72
  if i>4: continue
 
74
  res = inf['res']
75
  # his_datas[i*2] = f"[pose]({pose})"+f"![pose]({pose})"
76
  # his_datas[i*2+1] = f"[res]({res})"+f"![res]({res})"
 
77
  his_datas[i*2] = f"<img src=\"{pose}\" >"
78
  his_datas[i*2+1] = f"<img src=\"{res}\" >"
79
 
 
134
  with gr.Column():
135
  run_button = gr.Button(value="Run")
136
  init_res = get_result_example(cloth_examples[0][0], pose_examples[0][0])
137
+ # res_image = gr.Image(label="result image", value=None, type="filepath")
138
+ res_image = gr.Image(label="result image", value=None, type="numpy")
139
  # res_image = gr.Image(label="result image", value=cv2.imread(init_res),
140
  # type="numpy")
141
  info_text = gr.Textbox(value="", interactive=False,