Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -556,7 +556,7 @@ def isJSONSerialiazable(obj):
|
|
| 556 |
except:
|
| 557 |
return False
|
| 558 |
|
| 559 |
-
def updateItemDisplay(seshid, budget=False):
|
| 560 |
if True:
|
| 561 |
keys = ['filtered_items_room', 'current_img_signature', 'items', 'filtered_items_style', 'room_style', 'room_type', 'bedsize', 'price', 'filtered_items_colors', 'Palette_ids', 'item_data', 'item_data_', 'display_items', 'item_data_keys', 'Palettes_displayed', 'room_img_loaded', 'Paletteid', 'img_id', 'seshid']
|
| 562 |
url = 'https://dreamdemo.pythonanywhere.com/sesh'
|
|
@@ -585,7 +585,7 @@ def updateItemDisplay(seshid, budget=False):
|
|
| 585 |
|
| 586 |
sesh.product_means[sesh.current_img_signature] = {item:sum([float(pd['price'].replace('$', '').replace(',', '')) for pd in products])/len(products) if products else 0 for item,products in sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]].items() if item not in ['Palette', 'Living Room', 'Bedroom']}
|
| 587 |
|
| 588 |
-
if hasattr(sesh, 'budget_number') and sesh.budget_number:
|
| 589 |
print('updateItemDisplay -- sesh.budget_number: ', sesh.budget_number)
|
| 590 |
#product_lens = {item:len(products) for item,products in sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]].items() if item not in ['Palette', 'Living Room', 'Bedroom']}
|
| 591 |
#print('updateItemDisplay -- product_lens: ', product_lens)
|
|
@@ -803,7 +803,7 @@ def updateColors(evt: gr.SelectData, seshid):
|
|
| 803 |
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
|
| 804 |
|
| 805 |
if hasattr(sesh, 'room_img_loaded') and sesh.room_img_loaded:
|
| 806 |
-
display = updateItemDisplay(seshid)
|
| 807 |
return display
|
| 808 |
else:
|
| 809 |
return sesh.updated_display
|
|
|
|
| 556 |
except:
|
| 557 |
return False
|
| 558 |
|
| 559 |
+
def updateItemDisplay(seshid, budget=False, pallete_change=False):
|
| 560 |
if True:
|
| 561 |
keys = ['filtered_items_room', 'current_img_signature', 'items', 'filtered_items_style', 'room_style', 'room_type', 'bedsize', 'price', 'filtered_items_colors', 'Palette_ids', 'item_data', 'item_data_', 'display_items', 'item_data_keys', 'Palettes_displayed', 'room_img_loaded', 'Paletteid', 'img_id', 'seshid']
|
| 562 |
url = 'https://dreamdemo.pythonanywhere.com/sesh'
|
|
|
|
| 585 |
|
| 586 |
sesh.product_means[sesh.current_img_signature] = {item:sum([float(pd['price'].replace('$', '').replace(',', '')) for pd in products])/len(products) if products else 0 for item,products in sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]].items() if item not in ['Palette', 'Living Room', 'Bedroom']}
|
| 587 |
|
| 588 |
+
if hasattr(sesh, 'budget_number') and sesh.budget_number and not pallete_change:
|
| 589 |
print('updateItemDisplay -- sesh.budget_number: ', sesh.budget_number)
|
| 590 |
#product_lens = {item:len(products) for item,products in sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]].items() if item not in ['Palette', 'Living Room', 'Bedroom']}
|
| 591 |
#print('updateItemDisplay -- product_lens: ', product_lens)
|
|
|
|
| 803 |
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
|
| 804 |
|
| 805 |
if hasattr(sesh, 'room_img_loaded') and sesh.room_img_loaded:
|
| 806 |
+
display = updateItemDisplay(seshid, pallete_change=True)
|
| 807 |
return display
|
| 808 |
else:
|
| 809 |
return sesh.updated_display
|