selfitcamera commited on
Commit
25f6323
1 Parent(s): d8b06ca
Files changed (2) hide show
  1. app.py +2 -3
  2. utils.py +4 -1
app.py CHANGED
@@ -9,9 +9,8 @@ def onUpload():
9
  def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
10
  if pose_image is None:
11
  return None, "no pose image found !"
12
- print(pose_id, cloth_id)
13
  # pose_id, cloth_id = pose_id['label'], cloth_id['label']
14
- print(pose_id, cloth_id, size, (pose_image is None), len(pose_id)>0)
15
  if len(pose_id)>0:
16
  res = get_result_example(cloth_id, pose_id)
17
  # print(res)
@@ -67,7 +66,7 @@ def onLoad(request: gr.Request):
67
  his_datas = [None for _ in range(10)]
68
  try:
69
  infs = getAllInfs(ApiUrl, OpenId, ApiKey, client_ip)
70
- print(client_ip, 'infs', len(infs))
71
  for i, inf in enumerate(infs):
72
  if i>4: continue
73
  his_datas[i*2] = inf['pose']
 
9
  def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
10
  if pose_image is None:
11
  return None, "no pose image found !"
 
12
  # pose_id, cloth_id = pose_id['label'], cloth_id['label']
13
+ # print(pose_id, cloth_id, size, (pose_image is None), len(pose_id)>0)
14
  if len(pose_id)>0:
15
  res = get_result_example(cloth_id, pose_id)
16
  # print(res)
 
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']
utils.py CHANGED
@@ -13,6 +13,7 @@ import gradio as gr
13
  ApiUrl = os.environ['ApiUrl']
14
  OpenId = os.environ['OpenId']
15
  ApiKey = os.environ['ApiKey']
 
16
 
17
 
18
  proj_dir = os.path.dirname(os.path.abspath(__file__))
@@ -53,7 +54,9 @@ def getAllInfs(apiUrl, openId, apiKey, clientIp):
53
  if ret.status_code==200:
54
  if 'data' in ret.json():
55
  records = ret.json()['data']['records']
56
- res = [{'pose':record['body_url'], 'res':record['showUrl']} for record in records]
 
 
57
  return res
58
 
59
 
 
13
  ApiUrl = os.environ['ApiUrl']
14
  OpenId = os.environ['OpenId']
15
  ApiKey = os.environ['ApiKey']
16
+ OssUrl = os.environ['OssUrl']
17
 
18
 
19
  proj_dir = os.path.dirname(os.path.abspath(__file__))
 
54
  if ret.status_code==200:
55
  if 'data' in ret.json():
56
  records = ret.json()['data']['records']
57
+ for record in records:
58
+ res.append({'pose':OssUrl+record['body_url'],
59
+ 'res':OssUrl+record['showUrl']})
60
  return res
61
 
62