Update app.py
Browse files
app.py
CHANGED
|
@@ -837,6 +837,7 @@ def applyStyle(evt: gr.SelectData, seshid):
|
|
| 837 |
|
| 838 |
|
| 839 |
def dummyFrmt(frmt):
|
|
|
|
| 840 |
if True:
|
| 841 |
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']]
|
| 842 |
sesh.responses = asyncio.run(main(urls))
|
|
@@ -877,6 +878,20 @@ def dummyFrmt(frmt):
|
|
| 877 |
responses = asyncio.run(main_post(urls, headers, json_data, timeout=.5))
|
| 878 |
#responses = asyncio.run(main_post(urls, headers, json_data, timeout=3))
|
| 879 |
print('*-/*/-*-roomItemClick: dumped scriptgen_promise: ', responses)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 880 |
|
| 881 |
def roomItemClick(evt: gr.SelectData, seshid):
|
| 882 |
sesh = getSesh(seshid)
|
|
@@ -1133,6 +1148,7 @@ def changeSummaryFilter(evt: gr.SelectData, seshid):
|
|
| 1133 |
setSesh(seshid, sesh)
|
| 1134 |
return gr.Label('All', label='Merchant'), gr.Label(all_counts, label='Number of Items'), gr.Label('$'+str(np.round(all_totals, 2)), label='Total'), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.update(visible=bool(1)), gr.update(visible=bool(0))
|
| 1135 |
elif summary_radio == 'Script':
|
|
|
|
| 1136 |
#textgen for general audience, things to look out for or be aware of
|
| 1137 |
"""product_pd_counts = [(product,pd_count) for store in sesh.summary_joined for product,pd_count in sesh.summary_joined[store].items()]
|
| 1138 |
urls = [product_pd_count[1]['product_dict']['href'] for product_pd_count in product_pd_counts]
|
|
|
|
| 837 |
|
| 838 |
|
| 839 |
def dummyFrmt(frmt):
|
| 840 |
+
sesh = getSesh(seshid)
|
| 841 |
if True:
|
| 842 |
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']]
|
| 843 |
sesh.responses = asyncio.run(main(urls))
|
|
|
|
| 878 |
responses = asyncio.run(main_post(urls, headers, json_data, timeout=.5))
|
| 879 |
#responses = asyncio.run(main_post(urls, headers, json_data, timeout=3))
|
| 880 |
print('*-/*/-*-roomItemClick: dumped scriptgen_promise: ', responses)
|
| 881 |
+
setSesh(seshid, sesh)
|
| 882 |
+
|
| 883 |
+
def uploadStoreShop(seshid):
|
| 884 |
+
sesh = getSesh(seshid)
|
| 885 |
+
if True:
|
| 886 |
+
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']]
|
| 887 |
+
sesh.responses = asyncio.run(main(urls))
|
| 888 |
+
urls = ['https://dreamdemo.pythonanywhere.com/store_shop' for _ in range(len(urls))]
|
| 889 |
+
headers = [{'Content-type': 'application/json', 'Accept': 'text/plain'} for i,_ in enumerate(urls)]
|
| 890 |
+
responses = [r.decode('ISO-8859-1') if type(r) != type(None) else r for r in sesh.responses]
|
| 891 |
+
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']]
|
| 892 |
+
json_data = [json.dumps({'response': responses[i], 'item_locator_data': item_locator_data[i]}) for i,url in enumerate(urls)]
|
| 893 |
+
responses = asyncio.run(main_post(urls, headers, json_data, timeout=.5))
|
| 894 |
+
setSesh(seshid, sesh)
|
| 895 |
|
| 896 |
def roomItemClick(evt: gr.SelectData, seshid):
|
| 897 |
sesh = getSesh(seshid)
|
|
|
|
| 1148 |
setSesh(seshid, sesh)
|
| 1149 |
return gr.Label('All', label='Merchant'), gr.Label(all_counts, label='Number of Items'), gr.Label('$'+str(np.round(all_totals, 2)), label='Total'), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.update(visible=bool(1)), gr.update(visible=bool(0))
|
| 1150 |
elif summary_radio == 'Script':
|
| 1151 |
+
uploadStoreShop(seshid)
|
| 1152 |
#textgen for general audience, things to look out for or be aware of
|
| 1153 |
"""product_pd_counts = [(product,pd_count) for store in sesh.summary_joined for product,pd_count in sesh.summary_joined[store].items()]
|
| 1154 |
urls = [product_pd_count[1]['product_dict']['href'] for product_pd_count in product_pd_counts]
|