Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
lixiang46
commited on
Commit
•
8c2fca3
1
Parent(s):
5479e73
test
Browse files
app.py
CHANGED
@@ -12,9 +12,10 @@ import json
|
|
12 |
def start_tryon(person_img, garment_img, seed, randomize_seed):
|
13 |
if randomize_seed:
|
14 |
seed = random.randint(0, MAX_SEED)
|
15 |
-
encoded_person_img = cv2.imencode('.jpg', cv2.
|
16 |
encoded_person_img = base64.b64encode(encoded_person_img).decode('utf-8')
|
17 |
-
|
|
|
18 |
encoded_garment_img = base64.b64encode(encoded_garment_img).decode('utf-8')
|
19 |
|
20 |
url = "https://" + os.environ['tryon_url']
|
@@ -38,7 +39,7 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
|
|
38 |
result = base64.b64decode(result['result'])
|
39 |
result_np = np.frombuffer(result, np.uint8)
|
40 |
result_img = cv2.imdecode(result_np, cv2.IMREAD_UNCHANGED)
|
41 |
-
result_img = cv2.
|
42 |
info = "Success"
|
43 |
else:
|
44 |
info = "Try again latter"
|
|
|
12 |
def start_tryon(person_img, garment_img, seed, randomize_seed):
|
13 |
if randomize_seed:
|
14 |
seed = random.randint(0, MAX_SEED)
|
15 |
+
encoded_person_img = cv2.imencode('.jpg', cv2.cvtColor(person_img, cv2.COLOR_RGB2BGR))[1].tobytes()
|
16 |
encoded_person_img = base64.b64encode(encoded_person_img).decode('utf-8')
|
17 |
+
print(encoded_person_img)
|
18 |
+
encoded_garment_img = cv2.imencode('.jpg', cv2.cvtColor(garment_img, cv2.COLOR_RGB2BGR))[1].tobytes()
|
19 |
encoded_garment_img = base64.b64encode(encoded_garment_img).decode('utf-8')
|
20 |
|
21 |
url = "https://" + os.environ['tryon_url']
|
|
|
39 |
result = base64.b64decode(result['result'])
|
40 |
result_np = np.frombuffer(result, np.uint8)
|
41 |
result_img = cv2.imdecode(result_np, cv2.IMREAD_UNCHANGED)
|
42 |
+
result_img = cv2.cvtColor(result_img, cv2.COLOR_RGB2BGR)
|
43 |
info = "Success"
|
44 |
else:
|
45 |
info = "Try again latter"
|