Update app.py
Browse files
app.py
CHANGED
|
@@ -547,7 +547,7 @@ def updateItemDisplay(seshid, budget=False, pallete_change=False):
|
|
| 547 |
sesh.updated_display = realised_display
|
| 548 |
summarisePerStore(seshid)
|
| 549 |
|
| 550 |
-
sesh.product_pd_counts = [(product,pd_count) for store in sesh.summary_joined for product,pd_count in sesh.summary_joined[store].items()]
|
| 551 |
urls = [product_pd_count[1]['product_dict']['href'] for product_pd_count in sesh.product_pd_counts]
|
| 552 |
sesh.responses = asyncio.run(main(urls))
|
| 553 |
item_locator_data = {data[1]: 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']}
|
|
@@ -559,7 +559,24 @@ def updateItemDisplay(seshid, budget=False, pallete_change=False):
|
|
| 559 |
if tuple(idxs) not in sesh.locator_genid: sesh.locator_genid[tuple(idxs)] = gen_uid = str(time.time())
|
| 560 |
json_data = [json.dumps({'room_type': sesh.room_type, 'item_locator_data': item_locator_data[product_pd_count[0]], 'gen_uid': sesh.locator_genid[tuple(item_locator_data[product_pd_count[0]])], 'response':responses[i], 'item': product_pd_count[0]}) for i,product_pd_count in enumerate(sesh.product_pd_counts) if product_pd_count[0] not in ['Palette', 'Living Room', 'Bedroom']]
|
| 561 |
responses = asyncio.run(main_post(urls, headers, json_data, timeout=.1))
|
| 562 |
-
print('dump_text_gen: ', responses)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 563 |
|
| 564 |
setSesh(seshid, sesh)
|
| 565 |
return gr.Gallery(realised_display, label='Room Items', columns=5)
|
|
|
|
| 547 |
sesh.updated_display = realised_display
|
| 548 |
summarisePerStore(seshid)
|
| 549 |
|
| 550 |
+
"""sesh.product_pd_counts = [(product,pd_count) for store in sesh.summary_joined for product,pd_count in sesh.summary_joined[store].items()]
|
| 551 |
urls = [product_pd_count[1]['product_dict']['href'] for product_pd_count in sesh.product_pd_counts]
|
| 552 |
sesh.responses = asyncio.run(main(urls))
|
| 553 |
item_locator_data = {data[1]: 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']}
|
|
|
|
| 559 |
if tuple(idxs) not in sesh.locator_genid: sesh.locator_genid[tuple(idxs)] = gen_uid = str(time.time())
|
| 560 |
json_data = [json.dumps({'room_type': sesh.room_type, 'item_locator_data': item_locator_data[product_pd_count[0]], 'gen_uid': sesh.locator_genid[tuple(item_locator_data[product_pd_count[0]])], 'response':responses[i], 'item': product_pd_count[0]}) for i,product_pd_count in enumerate(sesh.product_pd_counts) if product_pd_count[0] not in ['Palette', 'Living Room', 'Bedroom']]
|
| 561 |
responses = asyncio.run(main_post(urls, headers, json_data, timeout=.1))
|
| 562 |
+
print('dump_text_gen: ', responses)"""
|
| 563 |
+
|
| 564 |
+
|
| 565 |
+
item_locator_data = content['item_locator_data']
|
| 566 |
+
responses = content['responses']
|
| 567 |
+
items = content['items']
|
| 568 |
+
number_of_items = min(max(content['number_of_items'], 3), 7)
|
| 569 |
+
room_type = content['room_type']
|
| 570 |
+
video_format = content['video_format']
|
| 571 |
+
|
| 572 |
+
formats = ['Youtube Long-Form', 'Youtube Short-Form', 'Facebook Long-Form', 'Instagram Reel', 'Tiktok', 'LinkedIn']
|
| 573 |
+
number_of_items = [7, 3, 7, 3, 3, 7]
|
| 574 |
+
urls = [sesh.item_data[img][sesh.item_data_keys[img]['room_type']][sesh.item_data_keys[img]['room_style']][sesh.item_data_keys[img]['price']][sesh.item_data_keys[img]['Paletteid']][itemidx_item[1]][itemidx_item[0]]['href'] for itemidx_item in sesh.display_items_[img]]]
|
| 575 |
+
sesh.responses = asyncio.run(main(urls))
|
| 576 |
+
responses = [r.decode('ISO-8859-1') if type(r) != type(None) else r for r in sesh.responses]
|
| 577 |
+
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']]
|
| 578 |
+
items = [data[1] for data in sesh.display_items_[sesh.current_img_signature] if data[1] not in ['Palette', 'Living Room', 'Bedroom']]]
|
| 579 |
+
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': sesh.locator_genid[tuple(item_locator_data[product_pd_count[0]])], 'responses':responses, 'items': items}) for i,fmt in enumerate(formats)]
|
| 580 |
|
| 581 |
setSesh(seshid, sesh)
|
| 582 |
return gr.Gallery(realised_display, label='Room Items', columns=5)
|