cmahima commited on
Commit
01b2828
1 Parent(s): 7366dc0

changes for price and url

Browse files
Files changed (2) hide show
  1. amazon_oxy.py +2 -2
  2. app.py +3 -3
amazon_oxy.py CHANGED
@@ -4,7 +4,7 @@ import os
4
 
5
  username = os.environ.get('USERNAME')
6
  passwd = os.environ.get('PASSWORD')
7
- def scrape_amazon(search_query, n =10):
8
  # Structure payload.
9
  payload = {
10
  'source': 'amazon_search',
@@ -31,7 +31,7 @@ def scrape_amazon(search_query, n =10):
31
  # Parse result.
32
  for item in result['results'][0]['content']['results']['organic']:
33
  if i<n:
34
- final_result[item['url_image']]= (item['price'],item['url'])
35
  i+=1
36
  else:
37
  break
 
4
 
5
  username = os.environ.get('USERNAME')
6
  passwd = os.environ.get('PASSWORD')
7
+ def scrape_amazon(search_query, n =20):
8
  # Structure payload.
9
  payload = {
10
  'source': 'amazon_search',
 
31
  # Parse result.
32
  for item in result['results'][0]['content']['results']['organic']:
33
  if i<n:
34
+ final_result[item['url_image']]= (item['price'],"amazon.com"+item['url'])
35
  i+=1
36
  else:
37
  break
app.py CHANGED
@@ -255,7 +255,7 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
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]
@@ -301,8 +301,8 @@ with image_blocks as demo:
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)
 
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]
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]
 
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, visible=False)
305
+ url_display = gr.Textbox(label="URL of Selected Image", interactive=False, visible=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)