Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,6 +71,8 @@ def get_tryon_result(model_name, garment1, garment2, seed=1234):
|
|
| 71 |
# model_name = "AI Model " + model_name.split("\\")[-1].split(".")[0] # windows
|
| 72 |
# model_name = "AI Model " + model_name.split("/")[-1].split(".")[0] # linux
|
| 73 |
# print(model_name)
|
|
|
|
|
|
|
| 74 |
|
| 75 |
if not model_name.startswith("AI Model "):
|
| 76 |
model_name = "AI Model " + model_name.split("/")[-1].split(".")[0]
|
|
@@ -201,8 +203,8 @@ with gr.Blocks(css = ".output-image, .input-image, .image-preview {height: 400px
|
|
| 201 |
bottom_btn4 = gr.Button("Shorts", variant="secondary")
|
| 202 |
|
| 203 |
with gr.Row():
|
| 204 |
-
garment_top = gr.Image(sources='upload', type="
|
| 205 |
-
garment_down = gr.Image(sources='upload', type="
|
| 206 |
|
| 207 |
run_button = gr.Button(value="Run")
|
| 208 |
|
|
@@ -230,36 +232,36 @@ with gr.Blocks(css = ".output-image, .input-image, .image-preview {height: 400px
|
|
| 230 |
|
| 231 |
# Connect buttons to load sample images
|
| 232 |
top_btn1.click(
|
| 233 |
-
lambda: load_sample_image(SAMPLE_CLOTHES["top"][0]),
|
| 234 |
outputs=[garment_top]
|
| 235 |
)
|
| 236 |
top_btn2.click(
|
| 237 |
-
lambda: load_sample_image(SAMPLE_CLOTHES["top"][1]),
|
| 238 |
outputs=[garment_top]
|
| 239 |
)
|
| 240 |
top_btn3.click(
|
| 241 |
-
lambda: load_sample_image(SAMPLE_CLOTHES["top"][2]),
|
| 242 |
outputs=[garment_top]
|
| 243 |
)
|
| 244 |
top_btn4.click(
|
| 245 |
-
lambda: load_sample_image(SAMPLE_CLOTHES["top"][3]),
|
| 246 |
outputs=[garment_top]
|
| 247 |
)
|
| 248 |
|
| 249 |
bottom_btn1.click(
|
| 250 |
-
lambda: load_sample_image(SAMPLE_CLOTHES["bottom"][0]),
|
| 251 |
outputs=[garment_down]
|
| 252 |
)
|
| 253 |
bottom_btn2.click(
|
| 254 |
-
lambda: load_sample_image(SAMPLE_CLOTHES["bottom"][1]),
|
| 255 |
outputs=[garment_down]
|
| 256 |
)
|
| 257 |
bottom_btn3.click(
|
| 258 |
-
lambda: load_sample_image(SAMPLE_CLOTHES["bottom"][2]),
|
| 259 |
outputs=[garment_down]
|
| 260 |
)
|
| 261 |
bottom_btn4.click(
|
| 262 |
-
lambda: load_sample_image(SAMPLE_CLOTHES["bottom"][3]),
|
| 263 |
outputs=[garment_down]
|
| 264 |
)
|
| 265 |
|
|
|
|
| 71 |
# model_name = "AI Model " + model_name.split("\\")[-1].split(".")[0] # windows
|
| 72 |
# model_name = "AI Model " + model_name.split("/")[-1].split(".")[0] # linux
|
| 73 |
# print(model_name)
|
| 74 |
+
garment1 = cv2.imread(garment1) # read path into numpy
|
| 75 |
+
garment1 = cv2.cvtColor(garment1, cv2.COLOR_BGR2RGB)
|
| 76 |
|
| 77 |
if not model_name.startswith("AI Model "):
|
| 78 |
model_name = "AI Model " + model_name.split("/")[-1].split(".")[0]
|
|
|
|
| 203 |
bottom_btn4 = gr.Button("Shorts", variant="secondary")
|
| 204 |
|
| 205 |
with gr.Row():
|
| 206 |
+
garment_top = gr.Image(sources='upload', type="filepath", label="top garment")
|
| 207 |
+
garment_down = gr.Image(sources='upload', type="filepath", label="lower garment")
|
| 208 |
|
| 209 |
run_button = gr.Button(value="Run")
|
| 210 |
|
|
|
|
| 232 |
|
| 233 |
# Connect buttons to load sample images
|
| 234 |
top_btn1.click(
|
| 235 |
+
lambda: load_sample_image(SAMPLE_CLOTHES["top"][0], outputs=[garment_top]),
|
| 236 |
outputs=[garment_top]
|
| 237 |
)
|
| 238 |
top_btn2.click(
|
| 239 |
+
lambda: load_sample_image(SAMPLE_CLOTHES["top"][1], outputs=[garment_top]),
|
| 240 |
outputs=[garment_top]
|
| 241 |
)
|
| 242 |
top_btn3.click(
|
| 243 |
+
lambda: load_sample_image(SAMPLE_CLOTHES["top"][2], outputs=[garment_top]),
|
| 244 |
outputs=[garment_top]
|
| 245 |
)
|
| 246 |
top_btn4.click(
|
| 247 |
+
lambda: load_sample_image(SAMPLE_CLOTHES["top"][3], outputs=[garment_top]),
|
| 248 |
outputs=[garment_top]
|
| 249 |
)
|
| 250 |
|
| 251 |
bottom_btn1.click(
|
| 252 |
+
lambda: load_sample_image(SAMPLE_CLOTHES["bottom"][0], outputs=[garment_down]),
|
| 253 |
outputs=[garment_down]
|
| 254 |
)
|
| 255 |
bottom_btn2.click(
|
| 256 |
+
lambda: load_sample_image(SAMPLE_CLOTHES["bottom"][1], outputs=[garment_down]),
|
| 257 |
outputs=[garment_down]
|
| 258 |
)
|
| 259 |
bottom_btn3.click(
|
| 260 |
+
lambda: load_sample_image(SAMPLE_CLOTHES["bottom"][2], outputs=[garment_down]),
|
| 261 |
outputs=[garment_down]
|
| 262 |
)
|
| 263 |
bottom_btn4.click(
|
| 264 |
+
lambda: load_sample_image(SAMPLE_CLOTHES["bottom"][3], outputs=[garment_down]),
|
| 265 |
outputs=[garment_down]
|
| 266 |
)
|
| 267 |
|