bigghuggs commited on
Commit
6346157
·
verified ·
1 Parent(s): d939e54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -571,8 +571,16 @@ def updateItemDisplay(seshid, budget=False, pallete_change=False):
571
  room_type = content['room_type']
572
  video_format = content['video_format']"""
573
 
 
 
 
 
 
 
 
 
574
 
575
- formats = ['Youtube Long-Form', 'Youtube Short-Form', 'Facebook Long-Form', 'Instagram Reel', 'Tiktok', 'LinkedIn']
576
  number_of_items = [7, 3, 7, 3, 3, 7]
577
  urls = [sesh.item_data[sesh.current_img_signature][sesh.item_data_keys[sesh.current_img_signature]['room_type']][sesh.item_data_keys[sesh.current_img_signature]['room_style']][sesh.item_data_keys[sesh.current_img_signature]['price']][sesh.item_data_keys[sesh.current_img_signature]['Paletteid']][itemidx_item[1]][itemidx_item[0]]['href'] for itemidx_item in sesh.display_items_[sesh.current_img_signature] if itemidx_item[1] not in ['Palette', 'Living Room', 'Bedroom']]
578
  sesh.responses = asyncio.run(main(urls))
@@ -585,7 +593,7 @@ def updateItemDisplay(seshid, budget=False, pallete_change=False):
585
  json_data = [json.dumps({'video_format': fmt, 'number_of_items': number_of_items[i], 'room_type': sesh.room_type, 'item_locator_data': item_locator_data, 'gen_uid': i, 'items': items}) for i,fmt in enumerate(formats)]
586
  responses = asyncio.run(main_post(urls, headers, json_data, timeout=.1))
587
  #responses = asyncio.run(main_post(urls, headers, json_data, timeout=3))
588
- print('*-/*/-*-updateDisplay: dumped scriptgen_promise: ', responses)
589
 
590
  setSesh(seshid, sesh)
591
  return gr.Gallery(realised_display, label='Room Items', columns=5)
 
571
  room_type = content['room_type']
572
  video_format = content['video_format']"""
573
 
574
+ urls = [sesh.item_data[sesh.current_img_signature][sesh.item_data_keys[sesh.current_img_signature]['room_type']][sesh.item_data_keys[sesh.current_img_signature]['room_style']][sesh.item_data_keys[sesh.current_img_signature]['price']][sesh.item_data_keys[sesh.current_img_signature]['Paletteid']][itemidx_item[1]][itemidx_item[0]]['href'] for itemidx_item in sesh.display_items_[sesh.current_img_signature] if itemidx_item[1] not in ['Palette', 'Living Room', 'Bedroom']]
575
+ sesh.responses = asyncio.run(main(urls))
576
+ urls = ['https://dreamdemo.pythonanywhere.com/store_shop' for _ in range(len(urls))]
577
+ headers = [{'Content-type': 'application/json', 'Accept': 'text/plain'} for i,_ in enumerate(urls)]
578
+ responses = [r.decode('ISO-8859-1') if type(r) != type(None) else r for r in sesh.responses]
579
+ item_locator_data = [sesh.item_data_[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][data[1]][data[0]] for data in sesh.display_items_[sesh.current_img_signature] if data[1] not in ['Palette', 'Living Room', 'Bedroom']]
580
+ json_data = [json.dumps({'response': responses[i], 'item_locator_data': item_locator_data[i]}) for i,url in enumerate(urls)]
581
+ responses = asyncio.run(main_post(urls, headers, json_data, timeout=.1))
582
 
583
+ """formats = ['Youtube Long-Form', 'Youtube Short-Form', 'Facebook Long-Form', 'Instagram Reel', 'Tiktok', 'LinkedIn']
584
  number_of_items = [7, 3, 7, 3, 3, 7]
585
  urls = [sesh.item_data[sesh.current_img_signature][sesh.item_data_keys[sesh.current_img_signature]['room_type']][sesh.item_data_keys[sesh.current_img_signature]['room_style']][sesh.item_data_keys[sesh.current_img_signature]['price']][sesh.item_data_keys[sesh.current_img_signature]['Paletteid']][itemidx_item[1]][itemidx_item[0]]['href'] for itemidx_item in sesh.display_items_[sesh.current_img_signature] if itemidx_item[1] not in ['Palette', 'Living Room', 'Bedroom']]
586
  sesh.responses = asyncio.run(main(urls))
 
593
  json_data = [json.dumps({'video_format': fmt, 'number_of_items': number_of_items[i], 'room_type': sesh.room_type, 'item_locator_data': item_locator_data, 'gen_uid': i, 'items': items}) for i,fmt in enumerate(formats)]
594
  responses = asyncio.run(main_post(urls, headers, json_data, timeout=.1))
595
  #responses = asyncio.run(main_post(urls, headers, json_data, timeout=3))
596
+ print('*-/*/-*-updateDisplay: dumped scriptgen_promise: ', responses)"""
597
 
598
  setSesh(seshid, sesh)
599
  return gr.Gallery(realised_display, label='Room Items', columns=5)