lixiang46 commited on
Commit
5699bf9
1 Parent(s): 89d59b3
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -19,7 +19,6 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
19
 
20
  url = "http://" + os.environ['tryon_url']
21
  token = os.environ['token']
22
- print(url, token)
23
  headers = {'Content-Type': 'application/json', 'token': token}
24
  data = {
25
  "clothImage": encoded_garment_img,
@@ -27,15 +26,15 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
27
  "seed": seed
28
  }
29
 
30
- # response = requests.post(url, headers=headers, data=json.dumps(data))
31
- # print("response code", response.status_code)
32
- # if response.status_code == 200:
33
- # result = response.json()
34
- # result = base64.b64decode(result['images'][0])
35
- # result_np = np.frombuffer(result, np.uint8)
36
- # result_img = cv2.imdecode(result_np, cv2.IMREAD_UNCHANGED)
37
 
38
- result_img = cv2.imdecode(np.frombuffer(base64.b64decode(encoded_person_img), np.uint8), cv2.IMREAD_UNCHANGED)
39
 
40
  return result_img, seed
41
 
 
19
 
20
  url = "http://" + os.environ['tryon_url']
21
  token = os.environ['token']
 
22
  headers = {'Content-Type': 'application/json', 'token': token}
23
  data = {
24
  "clothImage": encoded_garment_img,
 
26
  "seed": seed
27
  }
28
 
29
+ response = requests.post(url, headers=headers, data=json.dumps(data))
30
+ print("response code", response.status_code)
31
+ if response.status_code == 200:
32
+ result = response.json()
33
+ result = base64.b64decode(result['images'][0])
34
+ result_np = np.frombuffer(result, np.uint8)
35
+ result_img = cv2.imdecode(result_np, cv2.IMREAD_UNCHANGED)
36
 
37
+ # result_img = cv2.imdecode(np.frombuffer(base64.b64decode(encoded_person_img), np.uint8), cv2.IMREAD_UNCHANGED)
38
 
39
  return result_img, seed
40