Spaces:
Runtime error
Runtime error
add url
Browse files
app.py
CHANGED
@@ -310,7 +310,7 @@ with image_blocks as demo:
|
|
310 |
try_button = gr.Button(value="Try-on")
|
311 |
masked_img = gr.Image(label="Masked image output", elem_id="masked-img",show_share_button=False)
|
312 |
image_out = gr.Image(label="Output", elem_id="output-img",show_share_button=False)
|
313 |
-
buy_link = gr.Textbox(label="URL of Selected Image", interactive=False)
|
314 |
buy_button = gr.Button(value="Like it? Click to buy")
|
315 |
output = gr.HTML()
|
316 |
with gr.Column():
|
@@ -324,10 +324,11 @@ with image_blocks as demo:
|
|
324 |
image_gallery.select(select_image, [image_gallery, url_display], [garm_img, buy_link])
|
325 |
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')
|
326 |
#buy_button.click(fn=None,inputs=buy_link,js=f"(buy_link) => {{ window.open(buy_link.substring(buy_link.indexOf('amazon.com')), '_blank');console.log(buy_link) }}")
|
327 |
-
buy_button.click(fn=None,inputs=buy_link, js=f
|
328 |
const clean_link = buy_link.includes('http') ? buy_link : 'https://' + buy_link;
|
329 |
-
window.open(clean_link.substring(clean_link.indexOf(
|
330 |
console.log(clean_link);
|
331 |
-
}}
|
|
|
332 |
|
333 |
image_blocks.launch()
|
|
|
310 |
try_button = gr.Button(value="Try-on")
|
311 |
masked_img = gr.Image(label="Masked image output", elem_id="masked-img",show_share_button=False)
|
312 |
image_out = gr.Image(label="Output", elem_id="output-img",show_share_button=False)
|
313 |
+
buy_link = gr.Textbox(label="URL of Selected Image", interactive=False, visible= False)
|
314 |
buy_button = gr.Button(value="Like it? Click to buy")
|
315 |
output = gr.HTML()
|
316 |
with gr.Column():
|
|
|
324 |
image_gallery.select(select_image, [image_gallery, url_display], [garm_img, buy_link])
|
325 |
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')
|
326 |
#buy_button.click(fn=None,inputs=buy_link,js=f"(buy_link) => {{ window.open(buy_link.substring(buy_link.indexOf('amazon.com')), '_blank');console.log(buy_link) }}")
|
327 |
+
buy_button.click(fn=None,inputs=buy_link, js=f'''(buy_link) => {{
|
328 |
const clean_link = buy_link.includes('http') ? buy_link : 'https://' + buy_link;
|
329 |
+
window.open(clean_link.substring(clean_link.indexOf("amazon.com")), '_blank');
|
330 |
console.log(clean_link);
|
331 |
+
}}'''
|
332 |
+
)
|
333 |
|
334 |
image_blocks.launch()
|