cmahima commited on
Commit
f9902cb
1 Parent(s): 16c3d66

add logic for link

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -271,8 +271,8 @@ for ex_human in human_list_path:
271
  human_ex_list.append(ex_dict)
272
 
273
  def open_link(link):
274
- print(f"link here is {link}")
275
- webbrowser.open_new_tab(link)
276
  ##default human
277
 
278
 
@@ -321,7 +321,6 @@ with image_blocks as demo:
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_link])
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
- #buy_button.click(fn=None,inputs=buy_link,js=f"(buy_link) => {{ window.open(buy_link.replace('https://cmahima-virtual-tryon-demo.hf.space/',''), '_blank') }}")
325
- buy_button.click(fn=None,inputs=buy_link,js=f"(buy_link) => {{console.log(buy_link)}}")
326
 
327
  image_blocks.launch()
 
271
  human_ex_list.append(ex_dict)
272
 
273
  def open_link(link):
274
+ print(f"link is {link}")
275
+ return link
276
  ##default human
277
 
278
 
 
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_link])
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
+ buy_button.click(fn=None,inputs=buy_link,js=f"(buy_link) => {{ window.open(buy_link.substring(buy_link.indexOf('amazon.com')), '_blank'); }}")
 
325
 
326
  image_blocks.launch()