Spaces:
Sleeping
Sleeping
lixiang46
commited on
Commit
•
39cd34c
1
Parent(s):
8c2fca3
add examepls
Browse files- .gitattributes +4 -0
- app.py +11 -5
- assets/examples/garment1.png +3 -0
- assets/examples/model1.png +3 -0
- assets/examples/result1.png +3 -0
.gitattributes
CHANGED
@@ -36,3 +36,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
36 |
assets/cloth filter=lfs diff=lfs merge=lfs -text
|
37 |
assets/human filter=lfs diff=lfs merge=lfs -text
|
38 |
assets/title.md filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
36 |
assets/cloth filter=lfs diff=lfs merge=lfs -text
|
37 |
assets/human filter=lfs diff=lfs merge=lfs -text
|
38 |
assets/title.md filter=lfs diff=lfs merge=lfs -text
|
39 |
+
assets/examples filter=lfs diff=lfs merge=lfs -text
|
40 |
+
assets/examples/result1.png filter=lfs diff=lfs merge=lfs -text
|
41 |
+
assets/examples/garment1.png filter=lfs diff=lfs merge=lfs -text
|
42 |
+
assets/examples/model1.png filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -14,7 +14,6 @@ def start_tryon(person_img, garment_img, seed, 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 |
|
@@ -119,10 +118,17 @@ with gr.Blocks(css=css) as Tryon:
|
|
119 |
|
120 |
try_button.click(fn=start_tryon, inputs=[imgs, garm_img, seed, randomize_seed], outputs=[image_out, seed_used, result_info], api_name='tryon')
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
ip = requests.get('http://ifconfig.me/ip', timeout=1).text.strip()
|
128 |
print("ip address", ip)
|
|
|
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 |
encoded_garment_img = cv2.imencode('.jpg', cv2.cvtColor(garment_img, cv2.COLOR_RGB2BGR))[1].tobytes()
|
18 |
encoded_garment_img = base64.b64encode(encoded_garment_img).decode('utf-8')
|
19 |
|
|
|
118 |
|
119 |
try_button.click(fn=start_tryon, inputs=[imgs, garm_img, seed, randomize_seed], outputs=[image_out, seed_used, result_info], api_name='tryon')
|
120 |
|
121 |
+
with gr.Row(label="Examples"):
|
122 |
+
image1 = gr.Image(label="model", scale=1, value="examples/model1.png")
|
123 |
+
image2 = gr.Image(label="garment", scale=1, value="examples/garment1.jpg")
|
124 |
+
image3 = gr.Image(label="result", scale=1, value="examples/result1.png")
|
125 |
+
gr.Examples(
|
126 |
+
examples=[
|
127 |
+
["examples/model1.png", "examples/garment1.png", "examples/result1.png"]
|
128 |
+
],
|
129 |
+
inputs=[image1, image2, image3],
|
130 |
+
label=None,
|
131 |
+
)
|
132 |
|
133 |
ip = requests.get('http://ifconfig.me/ip', timeout=1).text.strip()
|
134 |
print("ip address", ip)
|
assets/examples/garment1.png
ADDED
Git LFS Details
|
assets/examples/model1.png
ADDED
Git LFS Details
|
assets/examples/result1.png
ADDED
Git LFS Details
|