Spaces:
Running
on
Zero
Running
on
Zero
changes for link
Browse files
app.py
CHANGED
@@ -253,9 +253,9 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
|
|
253 |
return images[0], mask_gray
|
254 |
# return images[0], mask_gray
|
255 |
# Function to handle image selection from the gallery
|
256 |
-
def select_image(images, evt: gr.SelectData):
|
257 |
-
print(
|
258 |
-
return images[evt.index][0]
|
259 |
|
260 |
garm_list = os.listdir(os.path.join(example_path,"cloth"))
|
261 |
garm_list_path = [os.path.join(example_path,"cloth",garm) for garm in garm_list]
|
@@ -277,7 +277,7 @@ for ex_human in human_list_path:
|
|
277 |
|
278 |
image_blocks = gr.Blocks(theme=gr.themes.Soft()).queue()
|
279 |
with image_blocks as demo:
|
280 |
-
gr.HTML("<center><h1>Shop with Window
|
281 |
gr.HTML("<center><p>Upload an image of yourself or select from examples then describe your garment in the text box and wait for the magic. β¨</p></center>")
|
282 |
|
283 |
with gr.Row():
|
@@ -299,30 +299,28 @@ with image_blocks as demo:
|
|
299 |
fetch_button = gr.Button("Fetch Products")
|
300 |
garm_img = gr.Image(label="Garment", sources='upload', type="pil")
|
301 |
|
302 |
-
image_gallery = gr.Gallery(label="
|
|
|
303 |
price_display = gr.Textbox(label="Price of Selected Image", interactive=False)
|
304 |
url_display = gr.Textbox(label="URL of Selected Image", interactive=False)
|
305 |
with gr.Column():
|
306 |
# image_out = gr.Image(label="Output", elem_id="output-img", height=400)
|
307 |
masked_img = gr.Image(label="Masked image output", elem_id="masked-img",show_share_button=False)
|
308 |
-
with gr.Column():
|
309 |
# image_out = gr.Image(label="Output", elem_id="output-img", height=400)
|
310 |
image_out = gr.Image(label="Output", elem_id="output-img",show_share_button=False)
|
311 |
|
312 |
with gr.Column():
|
313 |
try_button = gr.Button(value="Try-on")
|
|
|
314 |
with gr.Accordion(label="Advanced Settings", open=False):
|
315 |
with gr.Row():
|
316 |
denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
|
317 |
seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value=42)
|
318 |
-
|
319 |
|
320 |
fetch_button.click(fn=fetch_products, inputs=prompt, outputs=[image_gallery, price_display, url_display])
|
321 |
-
image_gallery.select(select_image, image_gallery, garm_img)
|
322 |
-
|
323 |
try_button.click(fn=start_tryon, inputs=[imgs, garm_img, prompt, is_checked,is_checked_crop, denoise_steps, seed], outputs=[image_out,masked_img], api_name='tryon')
|
324 |
-
|
325 |
|
326 |
-
|
327 |
-
|
328 |
image_blocks.launch()
|
|
|
253 |
return images[0], mask_gray
|
254 |
# return images[0], mask_gray
|
255 |
# Function to handle image selection from the gallery
|
256 |
+
def select_image(images, urls, evt: gr.SelectData):
|
257 |
+
print(urls)
|
258 |
+
return images[evt.index][0], urls[evt.index][0]
|
259 |
|
260 |
garm_list = os.listdir(os.path.join(example_path,"cloth"))
|
261 |
garm_list_path = [os.path.join(example_path,"cloth",garm) for garm in garm_list]
|
|
|
277 |
|
278 |
image_blocks = gr.Blocks(theme=gr.themes.Soft()).queue()
|
279 |
with image_blocks as demo:
|
280 |
+
gr.HTML("<center><h1>Shop with Window ποΈπππ</h1></center>")
|
281 |
gr.HTML("<center><p>Upload an image of yourself or select from examples then describe your garment in the text box and wait for the magic. β¨</p></center>")
|
282 |
|
283 |
with gr.Row():
|
|
|
299 |
fetch_button = gr.Button("Fetch Products")
|
300 |
garm_img = gr.Image(label="Garment", sources='upload', type="pil")
|
301 |
|
302 |
+
image_gallery = gr.Gallery(label="Generated images", show_label=True, elem_id="gallery"
|
303 |
+
, columns=[3], rows=[1], object_fit="contain", height="auto", allow_preview= False)
|
304 |
price_display = gr.Textbox(label="Price of Selected Image", interactive=False)
|
305 |
url_display = gr.Textbox(label="URL of Selected Image", interactive=False)
|
306 |
with gr.Column():
|
307 |
# image_out = gr.Image(label="Output", elem_id="output-img", height=400)
|
308 |
masked_img = gr.Image(label="Masked image output", elem_id="masked-img",show_share_button=False)
|
|
|
309 |
# image_out = gr.Image(label="Output", elem_id="output-img", height=400)
|
310 |
image_out = gr.Image(label="Output", elem_id="output-img",show_share_button=False)
|
311 |
|
312 |
with gr.Column():
|
313 |
try_button = gr.Button(value="Try-on")
|
314 |
+
buy_button = gr.Button(value="Like it? Click to buy")
|
315 |
with gr.Accordion(label="Advanced Settings", open=False):
|
316 |
with gr.Row():
|
317 |
denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
|
318 |
seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value=42)
|
319 |
+
|
320 |
|
321 |
fetch_button.click(fn=fetch_products, inputs=prompt, outputs=[image_gallery, price_display, url_display])
|
322 |
+
image_gallery.select(select_image, [image_gallery, url_display], [garm_img, buy_button])
|
|
|
323 |
try_button.click(fn=start_tryon, inputs=[imgs, garm_img, prompt, is_checked,is_checked_crop, denoise_steps, seed], outputs=[image_out,masked_img], api_name='tryon')
|
324 |
+
|
325 |
|
|
|
|
|
326 |
image_blocks.launch()
|