lixiang46 commited on
Commit
49eabb6
1 Parent(s): 76ab23b

add cookie

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -21,9 +21,9 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
21
 
22
  url = "http://" + os.environ['tryon_url']
23
  token = os.environ['token']
24
- print(url)
25
- print(token)
26
- headers = {'Content-Type': 'application/json', 'token': token}
27
  data = {
28
  "clothImage": encoded_garment_img,
29
  "humanImage": encoded_person_img,
@@ -33,7 +33,6 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
33
  response = requests.post(url, headers=headers, data=json.dumps(data))
34
  print("response code", response.status_code)
35
  print(response.text)
36
- print(response.content)
37
  result_img = None
38
  if response.status_code == 200:
39
  result = response.json()['result']
@@ -45,10 +44,8 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
45
  result_img = cv2.cvtColor(result_img, cv2.COLOR_RGB2BGR)
46
  info = "Success"
47
  else:
48
- print(response.text)
49
  info = "Try again latter"
50
  else:
51
- print(response.text)
52
  info = "URL error, pleace contact the admin"
53
 
54
  return result_img, seed, info
 
21
 
22
  url = "http://" + os.environ['tryon_url']
23
  token = os.environ['token']
24
+ cookie = os.environ['Cookie']
25
+
26
+ headers = {'Content-Type': 'application/json', 'token': token, 'Cookie': cookie}
27
  data = {
28
  "clothImage": encoded_garment_img,
29
  "humanImage": encoded_person_img,
 
33
  response = requests.post(url, headers=headers, data=json.dumps(data))
34
  print("response code", response.status_code)
35
  print(response.text)
 
36
  result_img = None
37
  if response.status_code == 200:
38
  result = response.json()['result']
 
44
  result_img = cv2.cvtColor(result_img, cv2.COLOR_RGB2BGR)
45
  info = "Success"
46
  else:
 
47
  info = "Try again latter"
48
  else:
 
49
  info = "URL error, pleace contact the admin"
50
 
51
  return result_img, seed, info