test_upload_ref / app.py
bigghuggs's picture
Update app.py
edbb610 verified
"""import gradio as gr
from datasets import load_dataset
import requests
#affordable_armchairs_art_deco_brown_light.json
#raw_datasets = load_dataset(path='bigghuggs/test', data_files='affordable_armchairs_art_deco_brown_light.json')
#print(type(raw_datasets))
def greet(name):
response = requests.get('https://dreamdemo.pythonanywhere.com/static/index-138adf03.css')
return "Hello " + name + "!!..."+str(response.content)
demo = gr.Interface(fn=greet, inputs='text', outputs="text")
demo.launch()
"""
import gradio as gr
import json
import time
import numpy as np
import random
import os
import asyncio
import aiohttp
import requests
from PIL import Image
import io
#from textgen import getTextGen,multiprocessPrompts
def getTextGen(prompt, model=''):
from huggingface_hub import InferenceClient
client = InferenceClient(token=os.getenv('inference'))
import time
good = False
response = ''
tries = 0
model = model if model else "mistralai/Mixtral-8x7B-Instruct-v0.1"
while not good and tries<=3:
try:
print('getTextGen -- trying prompt: ', model, prompt[:50])
response = client.text_generation(prompt, model=model, max_new_tokens=2500, temperature=.7)
print('getTextGen -- generated: ', response[:50], '\n\n')
good = True
except:
time.sleep(.7)
model = ["mistralai/Mistral-7B-Instruct-v0.2", "microsoft/Phi-3-mini-4k-instruct", "google/gemma-7b"][tries]
tries += 1
print('getTextGen -- retrying prompt: ', model, prompt[:50])
return response
def multiprocessPrompts(prompts):
from multiprocessing import Pool
import time
start = time.time()
with Pool(5) as p:
responses = p.map(getTextGen, prompts)
print(time.time()-start)
return responses
"""
Python subprocess non-blocking and non-breaking communicate.: https://gist.github.com/hzhu212/02d5d4845027411b6705f0dc19181ef5
select – Wait for I/O Efficiently
Purpose: Wait for notification that an input or output channel is ready.
"""
"""
folder_number = len(os.listdir(f'C:\\Users\\Wayne\\Documents\\room_shopping\\'))
directory = f'C:\\Users\\Wayne\\Documents\\room_shopping\\{folder_number}\\'
files = [f for f in os.listdir(directory)]
print('files: ', folder_number, len(files))
"""
js_func = """
function refresh() {
const url = new URL(window.location);
var currentdate = new Date();
var datetime = "Last Sync: " + currentdate.getDate() + "/"
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
console.log('datetime: ')
console.log(datetime)
if (url.searchParams.get('__theme') !== 'dark') {
url.searchParams.set('__theme', 'dark');
window.location.href = url.href;
}
}
"""
"""
room_item_placeholder_images_dict = {'BEDROOM FURNITURE':{'Bedroom': 'C:\\Users\\Wayne\\Downloads\\' + 'gray bedroom.png', 'Bedroom Set':'C:\\Users\\Wayne\\Downloads\\' + 'gray bedroom set.jpg', 'Beds':'C:\\Users\\Wayne\\Downloads\\' + 'gray bed.jpg', 'Mattresses':'C:\\Users\\Wayne\\Downloads\\' + 'gray matresses.jpg', 'Dressers': 'C:\\Users\\Wayne\\Downloads\\' + 'gray dresser.jpg', 'Nightstands': 'C:\\Users\\Wayne\\Downloads\\' + 'gray nightstand.jpg', 'Armoires':'C:\\Users\\Wayne\\Downloads\\' + 'gray armoires.jpg', 'Chests of drawers': 'C:\\Users\\Wayne\\Downloads\\' + 'gray chest of drawers.jpg', 'Mirrors':'C:\\Users\\Wayne\\Downloads\\' + 'gray bedroom mirror.jpg', 'Bedroom Chair':'C:\\Users\\Wayne\\Downloads\\' + 'gray bedroom chair.jpg', 'Rug':'C:\\Users\\Wayne\\Downloads\\' + 'gray bedroom rug.jpg', 'Bedding':'C:\\Users\\Wayne\\Downloads\\' + 'gray bedding.jpg', 'paint':'C:\\Users\\Wayne\\Downloads\\' + 'gray can of paint.jpg', 'Curtains':'C:\\Users\\Wayne\\Downloads\\' + 'gray bedroom curtains.jpg', 'Artwork':'C:\\Users\\Wayne\\Downloads\\' + 'gray bedroom art.jpg', 'Plant Pots':'C:\\Users\\Wayne\\Downloads\\' + 'gray plant pots.jpg', 'Indoor Plants':'C:\\Users\\Wayne\\Downloads\\' + 'gray plants.png'}, 'LIVING ROOM FURNITURE':{'Living Room': 'C:\\Users\\Wayne\\Downloads\\' + 'gray living room.png', 'Love Seats': 'C:\\Users\\Wayne\\Downloads\\' + 'gray love seat.jpg', 'Sofas': 'C:\\Users\\Wayne\\Downloads\\' + 'gray sofa.jpg', 'Armchairs':'C:\\Users\\Wayne\\Downloads\\' + 'gray armchair.jpg', 'Coffee tables': 'C:\\Users\\Wayne\\Downloads\\' + 'gray coffee table.jpg', 'End Tables': 'C:\\Users\\Wayne\\Downloads\\' + 'gray end table.jpg', 'TV stands': 'C:\\Users\\Wayne\\Downloads\\' + 'gray tv stand.jpg', 'Bookshelves': 'C:\\Users\\Wayne\\Downloads\\' + 'gray bookshelf.jpg', 'Media consoles':'C:\\Users\\Wayne\\Downloads\\' + 'gray media console.jpg', 'Sectionals':'C:\\Users\\Wayne\\Downloads\\' + 'gray sectional.jpg', 'Recliners':'C:\\Users\\Wayne\\Downloads\\' + 'gray recliner.jpg', 'Rug':'C:\\Users\\Wayne\\Downloads\\' + 'gray living room rug.jpg', 'paint':'C:\\Users\\Wayne\\Downloads\\' + 'gray can of paint.jpg', 'Curtains':'C:\\Users\\Wayne\\Downloads\\' + 'gray living room curtains.jpg', 'Artwork':'C:\\Users\\Wayne\\Downloads\\' + 'gray living room art.jpg', 'Plant Pots':'C:\\Users\\Wayne\\Downloads\\' + 'gray plant pots.jpg', 'Indoor Plants':'C:\\Users\\Wayne\\Downloads\\' + 'gray plants.png'}}
bedroom_item_placeholder_images = [(v, k) for k,v in room_item_placeholder_images_dict['BEDROOM FURNITURE'].items()]
livingroom_item_placeholder_images = [(v, k) for k,v in room_item_placeholder_images_dict['LIVING ROOM FURNITURE'].items()]
bedroom_item_placeholder_images = [(v, k) for k,v in room_item_placeholder_images_dict['BEDROOM FURNITURE'].items()]
#bedroom_item_placeholder_images = [(room_item_placeholder_images_dict['BEDROOM FURNITURE'][k], k) for k in bed_layout_new]
livingroom_item_placeholder_images = [(v, k) for k,v in room_item_placeholder_images_dict['LIVING ROOM FURNITURE'].items()]
#livingroom_item_placeholder_images = [(room_item_placeholder_images_dict['LIVING ROOM FURNITURE'][k], k) for k in living_layout_new ]
int_des_styles_keys = ['Mid-Century Modern', 'Coastal', 'Industrial', 'Scandinavian', 'Bohemian', 'Farmhouse', 'Contemporary', 'Transitional', 'Maximalist', 'Southwestern', 'Rustic', 'Mexican', 'Traditional', 'Art Deco', 'Shabby Chic']
styles_images = {style: {'bedroom': 'C:\\Users\\Wayne\\Downloads\\' + style + ' bedroom.jpg', 'living room': 'C:\\Users\\Wayne\\Downloads\\' + style + ' living room.jpg'} for style in int_des_styles_keys}
bed_layout_new = ['Artwork', 'Curtains', 'Palette', 'Rug', 'Mirrors', 'Bedroom Chair', 'Ottoman', 'Bedroom', 'Bedroom Set', 'Bedding']
"""
bed_layout_new = ['Artwork', 'Curtains', 'Palette', 'Bedroom Rug', 'Mirrors', 'Bedroom Chair', 'Ottoman', 'Bedroom', 'Bedroom Set', 'Bedding']
living_layout_new = ['Artwork', 'Curtains', 'Palette', 'Rug', 'Armchairs', 'End Tables', 'Love Seats', 'Living Room', 'Sofas', 'End Tables', 'Plant Pots', 'Indoor Plants', 'Coffee tables', 'TV stands', 'Artwork']
"""
bedrooms = {'bedroom 1': 'C:\\Users\\Wayne\\Downloads\\master bedroom.jpg', 'bedroom 2': 'C:\\Users\\Wayne\\Downloads\\guest bedroom 2 beds.jpg', "bedroom 3": 'C:\\Users\\Wayne\\Downloads\\boy bedroom 1 bed (n).jpg', "bedroom 4": 'C:\\Users\\Wayne\\Downloads\\kids bedroom with bunkbeds a.jpg', 'living room': 'C:\\Users\\Wayne\\Downloads\\living room.jpg'}
"""
img_url = 'https://dreamdemo.pythonanywhere.com/image/'
bedrooms = {'bedroom 1': img_url+'master bedroom.jpg', 'bedroom 2': img_url+'guest bedroom 2 beds.jpg', "bedroom 3": img_url+'boy bedroom 1 bed (n).jpg', "bedroom 4": img_url+'kids bedroom with bunkbeds a.jpg', 'living room': img_url+'living room.jpg'}
room_item_placeholder_images_dict = {'BEDROOM FURNITURE':{'Bedroom': img_url + 'gray bedroom.png', 'Bedroom Set':img_url + 'gray bedroom set.jpg', 'Beds':img_url + 'gray bed.jpg', 'Mattresses':img_url + 'gray matresses.jpg', 'Dressers': img_url + 'gray dresser.jpg', 'Nightstands': img_url + 'gray nightstand.jpg', 'Armoires':img_url + 'gray armoires.jpg', 'Chests of drawers': img_url + 'gray chest of drawers.jpg', 'Mirrors':img_url + 'gray bedroom mirror.jpg', 'Bedroom Chair':img_url + 'gray bedroom chair.jpg', 'Rug':img_url + 'gray bedroom rug.jpg', 'Bedding':img_url + 'gray bedding.jpg', 'paint':img_url + 'gray can of paint.jpg', 'Curtains':img_url + 'gray bedroom curtains.jpg', 'Artwork':img_url + 'gray bedroom art.jpg', 'Plant Pots':img_url + 'gray plant pots.jpg', 'Indoor Plants':img_url + 'gray plants.png'}, 'LIVING ROOM FURNITURE':{'Living Room': img_url + 'gray living room.png', 'Love Seats': img_url + 'gray love seat.jpg', 'Sofas': img_url + 'gray sofa.jpg', 'Armchairs':img_url + 'gray armchair.jpg', 'Coffee tables': img_url + 'gray coffee table.jpg', 'End Tables': img_url + 'gray end table.jpg', 'TV stands': img_url + 'gray tv stand.jpg', 'Bookshelves': img_url + 'gray bookshelf.jpg', 'Media consoles':img_url + 'gray media console.jpg', 'Sectionals':img_url + 'gray sectional.jpg', 'Recliners':img_url + 'gray recliner.jpg', 'Rug':img_url + 'gray living room rug.jpg', 'paint':img_url + 'gray can of paint.jpg', 'Curtains':img_url + 'gray living room curtains.jpg', 'Artwork':img_url + 'gray living room art.jpg', 'Plant Pots':img_url + 'gray plant pots.jpg', 'Indoor Plants':img_url + 'gray plants.png'}}
async def get(url, session):
try:
async with session.get(url=url, timeout=1.5) as response:
resp = await response.read()
print("Successfully got url {} with resp of length {}.".format(url, len(resp)))
return resp
except Exception as e:
print("Unable to get url {} due to {}.".format(url, e.__class__))
return None
async def main(urls):
async with aiohttp.ClientSession() as session:
ret = await asyncio.gather(*(get(url, session) for url in urls))
print("Finalized all. Return is a list of len {} outputs.".format(len(ret)))
return ret
def getVizText(html):
from bs4 import BeautifulSoup, NavigableString, Tag
soup = BeautifulSoup(str(html), 'html.parser')
viz_text = [tag.text for tag in soup.find_all() if tag.text and len(tag.find_all())==0 and tag.name not in ['style', 'script', 'head', 'title', 'meta', '[document]'] and not isinstance(tag, NavigableString)]
viz_text_str = '...'.join(viz_text).replace('\\n', '').replace('\\t', '').replace('\n', '').replace('\t', '')
return viz_text_str
def findShoppingRelevantTerms(html):
viz_text_str = getVizText(str(html.decode("utf-8")))
search_terms = [' off ', ' availability ', ' available ', ' delivery ', ' deliver ', ' ship ', ' shipping ', ' return ', ' returns ', ' exchange ', ' exchanges ', ' material ', ' materials ']
found_terms = {t:(lambda text, term_loc: text[term_loc-300:term_loc+300])(viz_text_str, viz_text_str.lower().find(t.lower())) for t in search_terms if (t != ' off ' and t in viz_text_str) or (t == ' off ' and t in viz_text_str and ('%' in viz_text_str or '$' in viz_text_str))}
return found_terms
"""
***
color_maps = {name_rgb[-1]: (['dark', 'light'][sum(name_rgb[-1])//3//128] + color) for color,clist in color_library_dict_.items() for name_rgb in clist}
color_maps_keys = list(color_maps)
getBestMatch = lambda targets, destination_val: np.argmin(np.sum(np.abs(np.subtract(targets, destination_val)), axis=1))
#bestmatch = getBestMatch(color_maps_keys, color_maps_keys[0])
l = [0,1,2,3]
makeCombos = lambda l: [(l[i],l[j]) for i in range(len(l)) for j in range(i+1, len(l))] + [(l[::-1][i],l[::-1][j]) for i in range(len(l)) for j in range(i+1, len(l))]
combos = makeCombos(l)
combos = [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]
def makePaletteMatchMap():
Palette_match_map = {}
combos = [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]
for str_id,rgbs in all_palette_data['palette_ids'].items():
for c in combos:
color1 = rgbs[c[0]]
color2 = rgbs[c[1]]
bestmatch1 = getBestMatch(color_maps_keys, color1)
best_color1_rgb = color_maps_keys[bestmatch1]
best_color1_name = color_maps[best_color1_rgb]
bestmatch2 = getBestMatch(color_maps_keys, color2)
best_color2_rgb = color_maps_keys[bestmatch2]
best_color2_name = color_maps[best_color2_rgb]
if best_color1_name not in Palette_match_map:
Palette_match_map[best_color1_name] = {}
if best_color2_name not in Palette_match_map[best_color1_name]:
Palette_match_map[best_color1_name][best_color2_name] = {}
Palette_match_map[best_color1_name][best_color2_name][str_id] = int(np.sum(rgbs)//12//128)
return Palette_match_map
Palette_match_map = makePaletteMatchMap()
"""
"""
***
with open(f"C:\\Users\\Wayne\\Documents\\pallet_match_map.json", 'r') as file:
Palette_match_map = json.load(file)
with open(f"C:\\Users\\Wayne\\Documents\\color_maps_.json", 'r') as file:
color_maps_ = json.load(file)
with open('C:\\Users\\Wayne\\Documents\\all_palette_data.json', 'r') as file:
all_palette_data = json.load(file)
color_maps = {tuple([int(c) for c in k.replace('(', '').replace(')', '').split(',')]):v for k,v in color_maps_.items()}
color_maps_keys = list(color_maps)
getBestMatch = lambda targets, destination_val: np.argmin(np.sum(np.abs(np.subtract(targets, destination_val)), axis=1))
combos = [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]
getRGBColorName = lambda rgb: color_maps[color_maps_keys[getBestMatch(color_maps_keys, rgb)]]
"""
int_des_styles_keys = ['Mid-Century Modern', 'Coastal', 'Industrial', 'Scandinavian', 'Bohemian', 'Farmhouse', 'Contemporary', 'Transitional', 'Maximalist', 'Southwestern', 'Rustic', 'Mexican', 'Traditional', 'Art Deco', 'Shabby Chic']
"""
styles_images = {style: {'bedroom': 'C:\\Users\\Wayne\\Downloads\\' + style + ' bedroom.jpg', 'living room': 'C:\\Users\\Wayne\\Downloads\\' + style + ' living room.jpg'} for style in int_des_styles_keys}
"""
styles_images = {style: {'bedroom': img_url + style + ' bedroom.jpg', 'living room': img_url + style + ' living room.jpg'} for style in int_des_styles_keys}
design_images = [(v['bedroom'], k) for k,v in styles_images.items()]
def writeForStoreProcessing(store, zipcode):
with open('C:\\Users\\Wayne\\Documents\\store_processors\\'+store+zipcode+'.json', 'w') as file:
json.dump({'store': store, 'zipcode': zipcode}, file)
alarm1 = ['If the matter of..', 'Should the issue of..', 'In the event that..', 'If..', 'Provided..', 'Given that..', 'Supposing..', 'Assuming..', 'On the condition that..', 'In the case that..', 'Provided that..', 'Given the scenario where..', 'Supposing the situation where..', 'Assuming the circumstance in which..', 'On the off-chance that..', 'In the event..', 'If the prospect of..', 'Provided the idea of..', 'Given the notion of..', 'Supposing the thought of..', 'Assuming the consideration of..', 'On the chance that..', 'In the instance..', 'If the possibility of..', 'Provided the eventuality of..', 'Given the contingency of..', 'Supposing the scenario of..', 'Assuming the situation of..', 'On the occasion that..', 'In the likelihood that..', 'If the prospect of..', 'Provided the idea of..', 'Given the notion of..', 'Supposing the thought of..', 'Assuming the consideration of..', 'On the chance that..', 'In the instance..', 'If the possibility of..', 'Provided the eventuality of..', 'Given the contingency of..', 'Supposing the scenario of..', 'Assuming the situation of..', 'On the occasion that..', 'In the likelihood that..', 'If the aspect of..', 'Provided the feature of..', 'Given the element of..', 'Supposing the component of..', 'Assuming the detail of..', 'On the chance that..', 'In the instance..', 'If the detail of..', 'Provided the facet of..', 'Given the dimension of..', 'Supposing the aspect of..', 'Assuming the attribute of..', 'On the occasion that..', 'In the likelihood that..', 'If the factor of..', 'Provided the variable of..', 'Given the element of..', 'Supposing the component of..', 'Assuming the detail of..', 'On the chance that..', 'In the instance..', 'If the particulars of..', 'Provided the specifics of..', 'Given the intricacies of..', 'Supposing the nuances of..', 'Assuming the subtleties of..', 'On the occasion that..', 'In the likelihood that..', 'If the matter of..', 'Provided the issue of..', 'Given the concern over..']
alarm2 = ['be a source of worry', 'is a cause for concern', 'is a source of unease', 'is a cause for apprehension', 'is a point of uneasiness', 'is a source of discomfort', 'is a cause for distress', 'is a cause for alarm', 'is a point of concern', 'troubles you', 'unsettles you', 'worries you', 'unnerves you', 'disturbs you', 'vexes you', 'distresses you', 'bothers you', 'unsettles you', 'worries you', 'unnerves you', 'disturbs you', 'vexes you', 'distresses you', 'is a source of unease for you', 'is a cause for apprehension', 'is a point of uneasiness', 'is a source of discomfort', 'is a cause for distress', 'is a point of concern', 'is a cause for alarm', 'is a point of concern', 'is a source of unease for you', 'is a cause for apprehension', 'is a point of uneasiness', 'is a source of discomfort', 'is a cause for distress', 'is a point of concern', 'is a cause for alarm', 'is a point of concern', 'is a source of unease for you', 'is a cause for apprehension', 'is a point of uneasiness', 'is a source of discomfort', 'is a cause for distress', 'is a point of concern', 'is a cause for alarm', 'is a point of concern', 'is a source of unease for you']
alarm3 = ['this might be worrying', 'this could be worrying to you', 'you might be worried', 'you may be worried', 'you may be concerned', 'you might be concerned', 'you might be uneasy', 'you may be uneasy', 'this may cause some apprehension', 'this could make you apprehensive', 'you may be apprehensive', 'you might be apprehensive', 'you may have some uneasiness', 'you might have some uneasiness', 'this might cause some uneasiness', 'it might make you uneasy', 'maybe you have some uneasiness', 'you may have some discomfort', 'you might have some discomfort', 'you could have some discomfort', 'maybe you have some discomfort', 'you may have some distress', 'this may cause some distress', 'it might give you some distress', 'you might have some distress', 'you could have some distress', 'maybe you have some distress', 'you might be alarmed', 'you may be alarmed', 'you could be alarmed', 'this might be alarming', 'you may find this alarming', 'maybe you are alarmed', 'you might find it concerning', 'you may find it concerning', 'you could find it concerning', 'maybe you find it concerning', 'this could be concerning', 'this may be concerning to you', 'you might be troubled', 'you may be troubled', 'you could be troubled', 'maybe you are troubled', 'you may be unsettled by this', 'you might be unsettled by this', 'you could be unsettled by this', 'maybe you are unsettled by this', 'you may find this unsettling', 'you might find it unsettling', 'you may find it worrying', 'you might find it worrying', 'you could find it worrying', 'maybe you find it worrying', 'you may find it unnerving', 'you might find it unnerving', 'you could find it unnerving', 'maybe you find it unnerving', 'maybe you are disturbed', 'maybe you find it disturbing', 'you may be disturbed', 'you might disturbed', 'this might disturb you', 'this may be disturbing to you', 'you could be disturbed this', 'you might be vexed', 'you may be vexed', 'you might find this vexing', 'maybe this is vexing', 'this maybe distresses you', 'this might distress you', 'this could distress you', 'you may be distressed', 'this might bother you', 'this could bother you', 'this maybe bothers you', 'you might be bothered', 'you may be bothered by this', 'this might be unsettling', 'this may be unsettling to you']
class Session():
def __init__(self):
self.match_counties = []
self.county = ""
self.prompts = {}
self.listing_details = {}
self.img_data = {}
self.bound_box_ij = (0,0)
self.stride_tm1 = 1
self.nudge = 1
self.impresh_image_rewrite = {}
self.Palettes = {}
self.activated_items = {}
self.filtered_files = {}
self.filtered_files_room = {}
self.filtered_files_style = {}
self.filtered_items_room = {}
self.filtered_items_style = {}
self.filtered_items_colors = {}
self.items = bed_layout_new
self.price = 'Affordable'.lower().split()[0]
self.bedsize = 'Queen'.lower().split()[0]
self.room_style = 'Mid-Century Modern'.lower().split()[0]
self.room_type = 'bedroom'
self.item_data = {}
self.item_data_ = {}
self.item_data_keys = {}
self.Palette_img = np.zeros((200,200,3)).astype(np.uint8)
self.Palette_img[:] = 128
self.default_img = np.zeros((200,200,3)).astype(np.uint8)
self.default_img[:] = 64
self.display_items = {}
self.Paletteid = None
self.clicked_displayed_product = ''
self.current_img_signature = self.img_id = None
self.updated_display = [((self.Palette_img if item == 'Palette' else self.default_img) if item in ['Palette', 'Living Room', 'Bedroom'] else room_item_placeholder_images_dict['LIVING ROOM FURNITURE'][item], item) for item in living_layout_new]
self.summary = {}
self.summary_closed = True
self.summary_radio = 'Complete'
self.product_means = {}
self.Palette_imgs = {}
self.Palette_ids = {}
self.Palettes_displayed = {}
self.items_layouts = {}
self.zipcode = '30054'
self.state = 'GA'
self.seshid = str(time.time())
self.time = ''
sesh = Session()
def submitPhoto(img, rooms):
sesh.current_img_signature = str(img.sum())
sesh.img_data[sesh.current_img_signature] = img
sesh.Palettes[sesh.current_img_signature] = {}
sesh.activated_items[sesh.current_img_signature] = {}
sesh.filtered_files[sesh.current_img_signature] = {}
sesh.filtered_files_room[sesh.current_img_signature] = {}
sesh.filtered_files_style[sesh.current_img_signature] = {}
sesh.Palette_img = np.zeros((200,200,3)).astype(np.uint8)
sesh.Palette_img[:] = 128
sesh.items_layouts[sesh.current_img_signature] = bed_layout_new
rooms = rooms if rooms else []
rooms.append((img, sesh.current_img_signature))
#return [(v,str(k)) for k,v in sesh.img_data.items()], gr.Image(label='Upload Room Photo
return rooms, gr.Image(label='Upload Room Photo')
def summarisePerStore():
sesh.summary_joined = {}
for imgid,product_dicts in sesh.summary.items():
for item_pd in product_dicts:
if not item_pd:
continue
item, pd = item_pd[0], item_pd[1]
store = pd['store'].split(' -')[0]
if store and store not in sesh.summary_joined:
sesh.summary_joined[store] = {'total': 0, 'num_items':0, 'descriptions':[], 'prices':[], 'sources':[]}
sesh.summary_joined[store]['total'] += float(pd['price'].replace('$', '').replace(',', '')) if pd['price'] and '$' in pd['price'] else 0
sesh.summary_joined[store]['prices'].append(pd['price'] if pd['price'] and '$' in pd['price'] else None)
sesh.summary_joined[store]['descriptions'].append(pd['description'])
sesh.summary_joined[store]['sources'].append(pd['href'])
sesh.summary_joined[store]['num_items'] += 1
def summarisePerStore():
sesh.summary_joined = {}
for imgid,product_dicts in sesh.summary.items():
for item_pd in product_dicts:
if not item_pd:
continue
item, pd = item_pd[0], item_pd[1]
store = pd['store'].split(' -')[0]
if store and store not in sesh.summary_joined:
sesh.summary_joined[store] = {}
"""if item and item not in sesh.summary_joined[store]:
sesh.summary_joined[store][item] = {}
if pd['description'] not in sesh.summary_joined[store][item]:
sesh.summary_joined[store][item][pd['description']] = {'product_dict': pd, 'count':1}"""
sesh.summary_joined[store][item] = {'product_dict': pd, 'count':1}
def updateItemDisplay(seshid, budget=False):
if True:
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']
url = 'https://dreamdemo.pythonanywhere.com/sesh'
data = sesh.__dict__
valid_data = {k:v for k,v in data.items() if k in keys}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
if True: #try:
"""sesh.filtered_items_room[sesh.current_img_signature] = {item: [] if item in ['Palette', 'Living Room', 'Bedroom'] else [f for f in files if '_'.join(item.lower().split()) in f] for item in sesh.items}
#print('updateItemDisplay -- sesh.filtered_items_room: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_room[sesh.current_img_signature].items()])
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Artwork', 'Plant Pots', 'Indoor Plants'] else [f for f in ifiles if '_'.join(sesh.room_style.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_room[sesh.current_img_signature].items()}
#print('updateItemDisplay -- sesh.filtered_items_style 1: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()])
if sesh.room_type == 'bedroom':
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item not in ['Bedroom Set', 'Bedding'] else [f for f in ifiles if '_'.join(sesh.bedsize.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
#print('updateItemDisplay -- sesh.filtered_items_style 2: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()])
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom'] else [f for f in ifiles if '_'.join(sesh.price.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
#print('updateItemDisplay -- sesh.filtered_items_style 3: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()])
lambdafunc = lambda substrs, f: substrs and substrs[0].lower() in f.lower() and (len(substrs)==1 or substrs[1] in f.lower())
sesh.filtered_items_colors[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Plant Pots', 'Indoor Plants', 'Coffee tables', 'TV stands', 'End Tables', 'Mirrors'] else [f for f in ifiles if any([lambdafunc(color.replace('-', ' ').split(), f) for color in sesh.Palettes[sesh.img_id][sesh.Palette_ids[sesh.current_img_signature]][1]])] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
#print('updateItemDisplay -- sesh.filtered_items_colors 1: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_colors[sesh.current_img_signature].items()])
sesh.filtered_items_colors[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Plant Pots', 'Indoor Plants', 'Mirrors'] else [f for f in ifiles if '_'.join(sesh.price.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_colors[sesh.current_img_signature].items()}
#print('updateItemDisplay -- sesh.filtered_items_colors 2: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_colors[sesh.current_img_signature].items()])
if sesh.current_img_signature not in sesh.item_data:
sesh.item_data[sesh.current_img_signature] = {}
sesh.item_data_[sesh.current_img_signature] = {}
sesh.display_items[sesh.current_img_signature] = {}
if sesh.room_type not in sesh.item_data[sesh.current_img_signature]:
sesh.item_data[sesh.current_img_signature][sesh.room_type] = {}
sesh.item_data_[sesh.current_img_signature][sesh.room_type] = {}
sesh.display_items[sesh.current_img_signature][sesh.room_type] = {}
if sesh.room_style not in sesh.item_data[sesh.current_img_signature][sesh.room_type]:
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style] = {}
sesh.item_data_[sesh.current_img_signature][sesh.room_type][sesh.room_style] = {}
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style] = {}
if sesh.price not in sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style]:
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price] = {}
sesh.item_data_[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price] = {}
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price] = {}
#sesh.Palettes[sesh.img_id][sesh.Palette_ids[sesh.current_img_signature]][1]
if sesh.Palette_ids[sesh.current_img_signature] not in sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price]:
print('from updateItemsDisplay / update color items -- updating Paletteid: ', sesh.room_type, sesh.current_img_signature, sesh.room_style, sesh.price, sesh.Paletteid, sesh.filtered_items_colors[sesh.current_img_signature])
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = {}
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = {}
sesh.item_data_[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = {}
for item,ifiles in sesh.filtered_items_colors[sesh.current_img_signature].items():
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] = []
sesh.item_data_[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] = []
for f in ifiles:
with open(directory+f, 'r') as openfile:
data = json.load(openfile)
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] += [d for d in data['data'] if 'https://encrypted' in d['img'] and 'gstatic.com/shopping?' in d['img'] and 'etsy' not in d['href'] and 'temu' not in d['href'] and 'poshmark' not in d['href'] and 'furnihq' not in d['href'] and 'utrade' not in d['href'] and 'mercari' not in d['href'] and 'circularhub' not in d['href'] and 'restaged' not in d['href'] and 'walmart' not in d['href'] and "https://ruralhandmade.com/productdetails/high-back-fabric-club-chair-modern-accent-chair-for-living"
not in d['href'] and 'emmaxtee' not in d['href'] and 'znts' not in d['href'] and d['store'] and '$' in d['price'] and all([not c.isalpha() for c in d['price']])]
sesh.item_data_keys[sesh.current_img_signature] = {'room_type': sesh.room_type, 'room_style':sesh.room_style, 'price': sesh.price, 'Paletteid': sesh.Palette_ids[sesh.current_img_signature]}"""
import json
r = requests.post(url, data=json.dumps(valid_data), headers=headers)
print('json return status code: ', r.status_code)
data_dict = json.loads(r.content)
for k in data_dict:
print('setting attr: ', k)
setattr(sesh, k, data_dict[k])
if True:
#sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = {item:[d for d in products if ((not budget or not hasattr(sesh,'item_budgets') or sesh.current_img_signature not in sesh.item_budgets) or float(d['price'].replace('$', '').replace(',', ''))<sesh.item_budgets[sesh.current_img_signature][item])] 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()}
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']}
if hasattr(sesh, 'budget_number') and sesh.budget_number:
print('updateItemDisplay -- sesh.budget_number: ', sesh.budget_number)
#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']}
#print('updateItemDisplay -- product_lens: ', product_lens)
sesh.product_means_total = sum([v for img in sesh.product_means for k,v in sesh.product_means[img].items()])
sesh.product_means_weights = {img:{item:avg/sesh.product_means_total for item,avg in sesh.product_means[img].items()} for img in sesh.product_means}
print('updateItemDisplay -- sesh.product_means, sesh.product_means_total, sesh.product_means_weights, budget: ', sesh.product_means, sesh.product_means_total, sesh.product_means_weights, budget)
sesh.item_budgets = {img: {item: int(weight*sesh.budget_number) for item,weight in weights.items()} for img,weights in sesh.product_means_weights.items()}
#sesh.item_data_keys[sesh.current_img_signature] = {'room_type': sesh.room_type, 'room_style':sesh.room_style, 'price': sesh.price, 'Paletteid': sesh.Palette_ids[sesh.current_img_signature], 'inbudget':{item:[didx for didx,d in enumerate(products) if ((not budget or not hasattr(sesh,'item_budgets') or sesh.current_img_signature not in sesh.item_budgets) or float(d['price'].replace('$', '').replace(',', ''))<sesh.item_budgets[sesh.current_img_signature][item])] 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()}}
sesh.inbudget = {img:{item:[didx for didx,d in enumerate(products) if float(d['price'].replace('$', '').replace(',', ''))<sesh.item_budgets[img][item]] for item,products in 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']].items()} for img in sesh.item_data_keys}
sesh.display_items_ = {img:[(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not 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']][item] else (sesh.display_items_[img][itemi][0] if sesh.display_items_[img][itemi][0] in sesh.inbudget[img][item] else (-1 if not sesh.inbudget[img][item] else np.random.choice(sesh.inbudget[img][item]))), item) for itemi,item in enumerate(sesh.items_layouts[img])] for img in sesh.item_data_keys}
else:
#sesh.item_data_keys[sesh.current_img_signature] = {'room_type': sesh.room_type, 'room_style':sesh.room_style, 'price': sesh.price, 'Paletteid': sesh.Palette_ids[sesh.current_img_signature], 'inbudget':{item:[didx for didx,d in enumerate(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()}}
sesh.inbudget = {img:{item:[didx for didx,d in enumerate(products)] for item,products in 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']].items()} for img in sesh.item_data_keys}
#print('room type: ', [(sesh.item_data_keys[img]['room_type'], None if not hasattr(sesh, 'display_items_') else [data[0] for itemis,data in sesh.display_items_[img].items()],) for img in sesh.item_data_keys])
print('room type: ', [sesh.item_data_keys[img]['room_type'] for img in sesh.item_data_keys])
#sesh.display_items_ = {img:[(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not 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']][item] else (sesh.display_items_[img][itemi][0] if hasattr(sesh, 'display_items_') and img in sesh.display_items_ and itemi in sesh.display_items_[img] and sesh.display_items_[img][itemi] and sesh.display_items_[img][itemi][0] in sesh.inbudget[img][item] else random.sample(list(range(len(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']][item]))), 1)[0]), item) for itemi,item in enumerate(sesh.items_layouts[img])] for img in sesh.item_data_keys}
sesh.display_items_ = {img:[(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not 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']][item] else (random.sample(list(range(len(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']][item]))), 1)[0]), item) for itemi,item in enumerate(sesh.items_layouts[img])] for img in sesh.item_data_keys}
if hasattr(sesh, 'budget_number') and sesh.budget_number:
print('updateDisplay -- sesh.item_budgets: ', sesh.item_budgets, sum([v for img in sesh.item_budgets for k,v in sesh.item_budgets[img].items()]))
"""if hasattr(sesh, 'budget_number') and sesh.budget_number and sesh.current_img_signature in sesh.item_data_keys and sesh.room_type == sesh.item_data_keys[sesh.current_img_signature]['room_type'] and sesh.room_style == sesh.item_data_keys[sesh.current_img_signature]['room_style'] and sesh.price == sesh.item_data_keys[sesh.current_img_signature]['price'] and sesh.Palette_ids[sesh.current_img_signature] == sesh.item_data_keys[sesh.current_img_signature]['Paletteid']:
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = [(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] else (sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][itemi][0] if sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][itemi][0] in sesh.item_data_keys[sesh.current_img_signature]['inbudget'][item] else (-1 if not sesh.item_data_keys[sesh.current_img_signature]['inbudget'][item] else np.random.choice(sesh.item_data_keys[sesh.current_img_signature]['inbudget'][item]))), item) for itemi,item in enumerate(sesh.items)]
else:
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = [(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] else random.sample(list(range(len(sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item]))), 1)[0], item) for item in sesh.items]"""
#sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = [(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] else random.sample(list(range(len(sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item]))), 1)[0], item) for item in sesh.items]
#print('updateItemsDisplay -- sesh.display_items: ', sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid])
#sesh.summary[sesh.current_img_signature] = [{} if itemidx_item[1] in ['Palette', 'Living Room', 'Bedroom'] else sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][itemidx_item[1]][itemidx_item[0]] for itemidx_item in sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid]]
#sesh.summary[sesh.current_img_signature] = [() if itemidx_item[1] in ['Palette', 'Living Room', 'Bedroom'] or itemidx_item[0] < 0 else (itemidx_item[1], sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][itemidx_item[1]][itemidx_item[0]]) for itemidx_item in sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]]]
sesh.summary = {img: [() if itemidx_item[1] in ['Palette', 'Living Room', 'Bedroom'] or itemidx_item[0] < 0 else (itemidx_item[1], 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]]) for itemidx_item in sesh.display_items_[img]] for img in sesh.display_items_}
#print('updateColors: ', sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid])
#realised_display = [((sesh.Palette_imgs[sesh.current_img_signature] if item_dataidx[1] == 'Palette' else sesh.img_data[sesh.img_id]) if item_dataidx[1] in ['Palette', 'Living Room', 'Bedroom'] else (sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item_dataidx[1]][item_dataidx[0]]['img'] if item_dataidx[0] >= 0 else sesh.default_img), item_dataidx[1]) for item_dataidx in sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]]]
realised_display = [((sesh.Palette_imgs[sesh.current_img_signature] if item_dataidx[1] == 'Palette' else sesh.img_data[sesh.img_id]) if item_dataidx[1] in ['Palette', 'Living Room', 'Bedroom'] else (sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item_dataidx[1]][item_dataidx[0]]['img'] if item_dataidx[0] >= 0 else sesh.default_img), item_dataidx[1]) for item_dataidx in sesh.display_items_[sesh.current_img_signature]]
#print('writing For Store Processing')
for item_dataidx in sesh.display_items_[sesh.current_img_signature]:
if item_dataidx[0] >= 0:
store = sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item_dataidx[1]][item_dataidx[0]]['store']
writeForStoreProcessing(store, sesh.zipcode)
#print('wrote For Store Processing: ', store)
#print('completed writing For Store Processing')
sesh.updated_display = realised_display
summarisePerStore()
"""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']
url = 'https://dreamdemo.pythonanywhere.com/sesh'
data = sesh.__dict__
valid_data = {k:v for k,v in data.items() if k in keys}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
print('json requests response: ', str({k:(type(v), None if type(v) != type(dict({})) or not v else (type(list(v.items())[0][0]), type(list(v.items())[0][1]))) for k,v in valid_data.items()}))
#print('json requests response: ', str({k:(type(v), None if type(v) != type(dict({})) or not v else (type(list(v.items())[0][0]), type(list(v.items())[0][1]))) for k,v in data.items()}))
r = requests.post(url, data=json.dumps(valid_data), headers=headers)
print('\njson requests response: ', str(r.content))"""
return gr.Gallery(realised_display, label='Room Items', columns=5)
else: #except:
return sesh.updated_display
def getMostUsedColorsRGB(img_bytes):
if True:
img = np.array(Image.open(io.BytesIO(img_bytes)))
else:
return []
imgq = img // 48 * 48
clr_counts = {}
for i in range(0, imgq.shape[0], 7):
for j in range(0, imgq.shape[1], 7):
clr = tuple(imgq[i,j])
if clr not in clr_counts:
clr_counts[clr] = 0
clr_counts[clr] += 1
clr_counts_ = {v:k for k,v in clr_counts.items()}
counts_srtd = sorted(clr_counts_)[::-1]
counts_srtd_rgb = [[int(val) for val in clr_counts_[i]] for i in counts_srtd[:7]]
return counts_srtd_rgb
def isJSONSerialiazable(obj):
try:
json.dumps(obj)
return True
except:
return False
def updateItemDisplay(seshid, budget=False, pallete_change=False):
if True:
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']
url = 'https://dreamdemo.pythonanywhere.com/sesh'
data = sesh.__dict__
valid_data = {k:v for k,v in data.items() if k in keys and isJSONSerialiazable(v)}
print('updateItemDisplay sesh keys: ', valid_data.keys())
valid_data['seshid'] = seshid
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
if True: #try:
print('new and improved updateDisplay -- Palette_ids, Paletteid: ', sesh.Palette_ids, sesh.Paletteid)
import json
r = requests.post(url, data=json.dumps(valid_data), headers=headers)
print('json return status code: ', r.status_code)
data_dict = json.loads(r.content)
for k in data_dict:
if k == 'seshid': continue
print('setting attr: ', k)
setattr(sesh, k, data_dict[k])
if True:
#sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = {item:[d for d in products if ((not budget or not hasattr(sesh,'item_budgets') or sesh.current_img_signature not in sesh.item_budgets) or float(d['price'].replace('$', '').replace(',', ''))<sesh.item_budgets[sesh.current_img_signature][item])] 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()}
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']}
if hasattr(sesh, 'budget_number') and sesh.budget_number and not pallete_change:
print('updateItemDisplay -- sesh.budget_number: ', sesh.budget_number)
#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']}
#print('updateItemDisplay -- product_lens: ', product_lens)
sesh.product_means_total = sum([v for img in sesh.product_means for k,v in sesh.product_means[img].items()])
sesh.product_means_weights = {img:{item:avg/sesh.product_means_total for item,avg in sesh.product_means[img].items()} for img in sesh.product_means}
print('updateItemDisplay -- sesh.product_means, sesh.product_means_total, sesh.product_means_weights, budget: ', sesh.product_means, sesh.product_means_total, sesh.product_means_weights, budget)
sesh.item_budgets = {img: {item: int(weight*sesh.budget_number) for item,weight in weights.items()} for img,weights in sesh.product_means_weights.items()}
#sesh.item_data_keys[sesh.current_img_signature] = {'room_type': sesh.room_type, 'room_style':sesh.room_style, 'price': sesh.price, 'Paletteid': sesh.Palette_ids[sesh.current_img_signature], 'inbudget':{item:[didx for didx,d in enumerate(products) if ((not budget or not hasattr(sesh,'item_budgets') or sesh.current_img_signature not in sesh.item_budgets) or float(d['price'].replace('$', '').replace(',', ''))<sesh.item_budgets[sesh.current_img_signature][item])] 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()}}
sesh.inbudget = {img:{item:[didx for didx,d in enumerate(products) if float(d['price'].replace('$', '').replace(',', ''))<sesh.item_budgets[img][item]] for item,products in 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']].items()} for img in sesh.item_data_keys}
sesh.display_items_ = {img:[(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not 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']][item] else (sesh.display_items_[img][itemi][0] if sesh.display_items_[img][itemi][0] in sesh.inbudget[img][item] else (-1 if not sesh.inbudget[img][item] else np.random.choice(sesh.inbudget[img][item]))), item) for itemi,item in enumerate(sesh.items_layouts[img])] for img in sesh.item_data_keys}
else:
#sesh.item_data_keys[sesh.current_img_signature] = {'room_type': sesh.room_type, 'room_style':sesh.room_style, 'price': sesh.price, 'Paletteid': sesh.Palette_ids[sesh.current_img_signature], 'inbudget':{item:[didx for didx,d in enumerate(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()}}
sesh.inbudget = {img:{item:[didx for didx,d in enumerate(products)] for item,products in 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']].items()} for img in sesh.item_data_keys}
#print('room type: ', [(sesh.item_data_keys[img]['room_type'], None if not hasattr(sesh, 'display_items_') else [data[0] for itemis,data in sesh.display_items_[img].items()],) for img in sesh.item_data_keys])
print('room type: ', [sesh.item_data_keys[img]['room_type'] for img in sesh.item_data_keys])
#sesh.display_items_ = {img:[(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not 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']][item] else (sesh.display_items_[img][itemi][0] if hasattr(sesh, 'display_items_') and img in sesh.display_items_ and itemi in sesh.display_items_[img] and sesh.display_items_[img][itemi] and sesh.display_items_[img][itemi][0] in sesh.inbudget[img][item] else random.sample(list(range(len(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']][item]))), 1)[0]), item) for itemi,item in enumerate(sesh.items_layouts[img])] for img in sesh.item_data_keys}
item_lens = [(item, len(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']][item])) for itemi,item in enumerate(sesh.items_layouts[sesh.current_img_signature])]
getSampleIndexes = lambda lngth: sorted(set([int(i) for j in [2,3,4] for i in [np.clip(0,lngth-1,lngth//j), np.clip(0,lngth-1,lngth-(lngth//j))]] + [0,(lngth-1 if lngth > 0 else 0)]))
item_idxs = [(pair[0], [] if pair[1] <= 0 else getSampleIndexes(pair[1])) for pair in item_lens]
item_lens_ln = [len(pair[1]) for pair in item_idxs]
urls = [sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][pair[0]][idx]['img'] for i,pair in enumerate(item_idxs) if pair[1] for idx in pair[1]]
start = time.time()
responses = asyncio.run(main(urls))
rgbs = [getMostUsedColorsRGB(r) for r in responses]
pallete_rgb = list(set([tuple([int(val) for val in rgb]) for row in sesh.Palette_img for rgb in row]))
url = 'https://dreamdemo.pythonanywhere.com/rgb'
valid_data = {'rgbs':rgbs, 'pallete_rgb':pallete_rgb}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(valid_data), headers=headers)
jsondata = json.loads(r.content)
scores = jsondata['data']
section_scores = [scores[sum(item_lens_ln[:i]):sum(item_lens_ln[:i])+ln] for i,ln in enumerate(item_lens_ln)]
section_scores_amax = [np.argmax(s) if s else -1 for s in section_scores]
best_idxs = {item_idxs[i][0]: item_idxs[i][1][idx] if idx > -1 else -1 for i,idx in enumerate(section_scores_amax)}
end = time.time()
print('updateDisplay -- item images downloaded: ', str(end-start), best_idxs)
#sesh.display_items_ = {img:[(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not 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']][item] else (random.sample(list(range(len(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']][item]))), 1)[0]), item) for itemi,item in enumerate(sesh.items_layouts[img])] for img in sesh.item_data_keys}
sesh.display_items_ = {img:[(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not 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']][item] else (random.sample(list(range(len(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']][item]))), 1)[0] if img != sesh.current_img_signature else best_idxs[item]), item) for itemi,item in enumerate(sesh.items_layouts[img])] for img in sesh.item_data_keys}
if hasattr(sesh, 'budget_number') and sesh.budget_number:
print('updateDisplay -- sesh.item_budgets: ', sesh.item_budgets, sum([v for img in sesh.item_budgets for k,v in sesh.item_budgets[img].items()]))
"""if hasattr(sesh, 'budget_number') and sesh.budget_number and sesh.current_img_signature in sesh.item_data_keys and sesh.room_type == sesh.item_data_keys[sesh.current_img_signature]['room_type'] and sesh.room_style == sesh.item_data_keys[sesh.current_img_signature]['room_style'] and sesh.price == sesh.item_data_keys[sesh.current_img_signature]['price'] and sesh.Palette_ids[sesh.current_img_signature] == sesh.item_data_keys[sesh.current_img_signature]['Paletteid']:
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = [(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] else (sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][itemi][0] if sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][itemi][0] in sesh.item_data_keys[sesh.current_img_signature]['inbudget'][item] else (-1 if not sesh.item_data_keys[sesh.current_img_signature]['inbudget'][item] else np.random.choice(sesh.item_data_keys[sesh.current_img_signature]['inbudget'][item]))), item) for itemi,item in enumerate(sesh.items)]
else:
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = [(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] else random.sample(list(range(len(sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item]))), 1)[0], item) for item in sesh.items]"""
#sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]] = [(-1 if item in ['Palette', 'Living Room', 'Bedroom'] or not sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item] else random.sample(list(range(len(sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item]))), 1)[0], item) for item in sesh.items]
#print('updateItemsDisplay -- sesh.display_items: ', sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid])
#sesh.summary[sesh.current_img_signature] = [{} if itemidx_item[1] in ['Palette', 'Living Room', 'Bedroom'] else sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][itemidx_item[1]][itemidx_item[0]] for itemidx_item in sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid]]
#sesh.summary[sesh.current_img_signature] = [() if itemidx_item[1] in ['Palette', 'Living Room', 'Bedroom'] or itemidx_item[0] < 0 else (itemidx_item[1], sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][itemidx_item[1]][itemidx_item[0]]) for itemidx_item in sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]]]
sesh.summary = {img: [() if itemidx_item[1] in ['Palette', 'Living Room', 'Bedroom'] or itemidx_item[0] < 0 else (itemidx_item[1], 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]]) for itemidx_item in sesh.display_items_[img]] for img in sesh.display_items_}
#print('updateColors: ', sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid])
#realised_display = [((sesh.Palette_imgs[sesh.current_img_signature] if item_dataidx[1] == 'Palette' else sesh.img_data[sesh.img_id]) if item_dataidx[1] in ['Palette', 'Living Room', 'Bedroom'] else (sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item_dataidx[1]][item_dataidx[0]]['img'] if item_dataidx[0] >= 0 else sesh.default_img), item_dataidx[1]) for item_dataidx in sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]]]
realised_display = [((sesh.Palette_imgs[sesh.current_img_signature] if item_dataidx[1] == 'Palette' else sesh.img_data[sesh.img_id]) if item_dataidx[1] in ['Palette', 'Living Room', 'Bedroom'] else (sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item_dataidx[1]][item_dataidx[0]]['img'] if item_dataidx[0] >= 0 else sesh.default_img), item_dataidx[1]) for item_dataidx in sesh.display_items_[sesh.current_img_signature]]
#print('writing For Store Processing')
for item_dataidx in sesh.display_items_[sesh.current_img_signature]:
if item_dataidx[0] >= 0:
store = sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item_dataidx[1]][item_dataidx[0]]['store']
writeForStoreProcessing(store, sesh.zipcode)
#print('wrote For Store Processing: ', store)
#print('completed writing For Store Processing')
sesh.updated_display = realised_display
summarisePerStore()
return gr.Gallery(realised_display, label='Room Items', columns=5)
else: #except:
return sesh.updated_display
"""
sesh.Palettes
dummy = "filtered_items_room, sesh.current_img_signature, sesh.items, sesh.filtered_items_style, sesh.room_style, sesh.room_type, sesh.bedsize, sesh.price, sesh.filtered_items_colors, sesh.Palette_ids, sesh.item_data, sesh.item_data_, sesh.display_items, sesh.item_data_keys, sesh.Palettes_displayed, sesh.room_img_loaded, sesh.Paletteid, sesh.img_id"
url = 'https://dreamdemo.pythonanywhere.com/sesh'
data = {'sender': 'Alice', 'receiver': 'Bob', 'message': 'We did it!'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)
r.content
"""
"""
within budget
prob/smll brkrg not get it
first mover
"""
def updateRoomType(evt: gr.SelectData, seshid):
label = evt.value['caption'].lower().split()[0] if evt.value['caption'] else sesh.room_type
sesh.room_type = label
images = [(v['bedroom'] if sesh.room_type == 'bedroom' else v['living room'], k) for k,v in styles_images.items()]
sesh.items = items = bed_layout_new if sesh.room_type == 'bedroom' else living_layout_new
sesh.items_layouts[sesh.current_img_signature] = items = bed_layout_new if sesh.room_type == 'bedroom' else living_layout_new
#display = updateItemDisplay()
if hasattr(sesh, 'room_img_loaded') and sesh.room_img_loaded:
display = updateItemDisplay(seshid)
else:
display = sesh.updated_display
return images, gr.Radio(['Full', 'Queen', 'King'], value='Full', label='Bed Size', interactive=True, visible=True) if label == 'bedroom' else gr.Radio(visible=False), gr.Gallery(sesh.updated_display, label='Room Items', columns=5), display
"""sesh.filtered_items_room[sesh.current_img_signature] = {item: [] if item in ['Palette', 'Living Room', 'Bedroom'] else [f for f in files if '_'.join(item.lower().split()) in f] for item in sesh.items}
print('updateRoomType: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_room[sesh.current_img_signature].items()])
room_items_imgs_tuples = [((sesh.Palette_img if item == 'Palette' else sesh.img_data[sesh.img_id]) if item in ['Palette', 'Living Room', 'Bedroom'] else room_item_placeholder_images_dict['BEDROOM FURNITURE' if label == 'bedroom' else 'LIVING ROOM FURNITURE'][item], item) for item in items]
sesh.updated_display = room_items_imgs_tuples
return images, gr.Radio(['Full', 'Queen', 'King'], value='Full', label='Bed Size', interactive=True, visible=True) if label == 'bedroom' else gr.Radio(visible=False), gr.Gallery(sesh.updated_display, label='Room Items', columns=5)"""
def updateStyle(evt: gr.SelectData, seshid):
style = evt.value['caption'].lower().split()[0] if evt.value['caption'] else sesh.room_style
sesh.room_style = style
if hasattr(sesh, 'room_img_loaded') and sesh.room_img_loaded:
display = updateItemDisplay(seshid)
return display
else:
return sesh.updated_display
"""sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Artwork', 'Plant Pots', 'Indoor Plants'] else [f for f in ifiles if '_'.join(sesh.room_style.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_room[sesh.current_img_signature].items()}
if sesh.room_type == 'bedroom':
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Artwork', 'Plant Pots', 'Indoor Plants'] else [f for f in ifiles if '_'.join(sesh.bedsize.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom'] else [f for f in ifiles if '_'.join(sesh.price.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
print('updateStyle: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()])"""
def updatePrice(evt: gr.SelectData, seshid):
print('updatePrice: ', type(evt.value), evt.value)
price = evt.value if evt.value else sesh.price
sesh.price = price
if hasattr(sesh, 'room_img_loaded') and sesh.room_img_loaded:
display = updateItemDisplay(seshid)
return display
else:
return sesh.updated_display
"""sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Artwork', 'Plant Pots', 'Indoor Plants'] else [f for f in ifiles if '_'.join(sesh.room_style.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_room[sesh.current_img_signature].items()}
if sesh.room_type == 'bedroom':
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Artwork', 'Plant Pots', 'Indoor Plants'] else [f for f in ifiles if '_'.join(sesh.bedsize.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom'] else [f for f in ifiles if '_'.join(sesh.price.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
print('updatePrice: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()]) """
def updateBedsize(evt: gr.SelectData, seshid):
bedsize = evt.value if evt.value else sesh.bedsize
sesh.bedsize = bedsize
if hasattr(sesh, 'room_img_loaded') and sesh.room_img_loaded:
display = updateItemDisplay(seshid)
return display
else:
return sesh.updated_display
"""sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Artwork', 'Plant Pots', 'Indoor Plants'] else [f for f in ifiles if '_'.join(sesh.room_style.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_room[sesh.current_img_signature].items()}
if sesh.room_type == 'bedroom':
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Artwork', 'Plant Pots', 'Indoor Plants'] else [f for f in ifiles if '_'.join(sesh.bedsize.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
sesh.filtered_items_style[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom'] else [f for f in ifiles if '_'.join(sesh.price.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
print('updatePrice: ', [(item,len(ifiles)) for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()]) """
#sesh.palettes_data
def updateColors(evt: gr.SelectData, seshid):
Paletteid = evt.value['caption'] if evt.value['caption'] else '0'
sesh.Paletteid = evt.value['caption']
sesh.Palette_ids[sesh.current_img_signature] = Paletteid
sesh.Palette_img = np.zeros((200,200,3)).astype(np.uint8)
"""sesh.Palette_img[:50,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][0]
sesh.Palette_img[50:100,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][1]
sesh.Palette_img[100:150,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][2]
sesh.Palette_img[150:,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][3]"""
sesh.Palette_img[:50,:] = sesh.palettes_data[sesh.Paletteid][0]
sesh.Palette_img[50:100,:] = sesh.palettes_data[sesh.Paletteid][1]
sesh.Palette_img[100:150,:] = sesh.palettes_data[sesh.Paletteid][2]
sesh.Palette_img[150:,:] = sesh.palettes_data[sesh.Paletteid][3]
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
if hasattr(sesh, 'room_img_loaded') and sesh.room_img_loaded:
display = updateItemDisplay(seshid, pallete_change=True)
return display
else:
return sesh.updated_display
"""lambdafunc = lambda substrs, f: substrs and substrs[0].lower() in f.lower() and (len(substrs)==1 or substrs[1] in f.lower())
sesh.filtered_items_colors[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Plant Pots', 'Indoor Plants', 'Coffee tables', 'TV stands', 'End Tables'] else [f for f in ifiles if any([lambdafunc(color.replace('-', ' ').split(), f) for color in sesh.Palettes[sesh.img_id][sesh.Paletteid][1]])] for item,ifiles in sesh.filtered_items_style[sesh.current_img_signature].items()}
sesh.filtered_items_colors[sesh.current_img_signature] = {item: ifiles if item in ['Palette', 'Living Room', 'Bedroom', 'Plant Pots', 'Indoor Plants'] else [f for f in ifiles if '_'.join(sesh.price.replace('-', ' ').lower().split()) in f] for item,ifiles in sesh.filtered_items_colors[sesh.current_img_signature].items()}
if sesh.current_img_signature not in sesh.item_data:
sesh.item_data[sesh.current_img_signature] = {}
sesh.display_items[sesh.current_img_signature] = {}
if sesh.room_type not in sesh.item_data[sesh.current_img_signature]:
sesh.item_data[sesh.current_img_signature][sesh.room_type] = {}
sesh.display_items[sesh.current_img_signature][sesh.room_type] = {}
if sesh.room_style not in sesh.item_data[sesh.current_img_signature][sesh.room_type]:
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style] = {}
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style] = {}
if sesh.price not in sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style]:
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price] = {}
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price] = {}
if sesh.Paletteid not in sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price]:
#print('updateColors -- updating Paletteid: ', sesh.room_type, sesh.current_img_signature, sesh.room_style, sesh.price, sesh.Paletteid, sesh.filtered_items_colors[sesh.current_img_signature])
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid] = {}
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid] = {}
for item,ifiles in sesh.filtered_items_colors[sesh.current_img_signature].items():
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item] = []
for f in ifiles:
with open(directory+f, 'r') as openfile:
data = json.load(openfile)
sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item] += [d for d in data['data'] if 'https' in d['img']]
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid] = [((sesh.Palette_img if item == 'Palette' else sesh.img_data[sesh.img_id]) if item in ['Palette', 'Living Room', 'Bedroom'] else sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item][random.sample(list(range(len(sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item]))), 1)[0]]['img'], item) for item in sesh.items]
sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid] = [(-1 if item in ['Palette', 'Living Room', 'Bedroom'] else random.sample(list(range(len(sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item]))), 1)[0], item) for item in sesh.items]
#print('updateColors: ', sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid])
realised_display = [((sesh.Palette_img if item_dataidx[1] == 'Palette' else sesh.img_data[sesh.img_id]) if item_dataidx[1] in ['Palette', 'Living Room', 'Bedroom'] else sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item_dataidx[1]][item_dataidx[0]]['img'], item_dataidx[1]) for item_dataidx in sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid]]
sesh.updated_display = realised_display
summarisePerStore()
return gr.Gallery(realised_display, label='Room Items', columns=5) """
#Palettes_displayed, Palettes
def makePalettes(evt: gr.SelectData, seshid):
#print('makePalettes: ', type(evt.value), evt.value)
sesh.img_id = sesh.current_img_signature = evt.value['caption'] if evt.value['caption'] else sesh.current_img_signature
if sesh.current_img_signature in sesh.Palettes_displayed:
display = updateItemDisplay(seshid)
return sesh.Palettes_displayed[sesh.current_img_signature], sesh.img_data[sesh.current_img_signature], display
img = sesh.img_data[sesh.img_id]
imgq = img // 48 * 48
Palette_out = []
Palette_accounting = []
clr_counts = {}
for i in range(imgq.shape[0]):
for j in range(imgq.shape[1]):
clr = tuple(imgq[i,j])
if clr not in clr_counts:
clr_counts[clr] = 0
clr_counts[clr] += 1
clr_counts_ = {v:k for k,v in clr_counts.items()}
counts_srtd = sorted(clr_counts_)[::-1]
#counts_srtd_rgb = [clr_counts_[i] for i in counts_srtd[:4]]
counts_srtd_rgb = [[int(val) for val in clr_counts_[i]] for i in counts_srtd[:4]]
#bestclr_keys = [color_maps[color_maps_keys[getBestMatch(color_maps_keys, rgb)]] for rgb in counts_srtd_rgb]
dark_light_bool = int(np.sum(counts_srtd_rgb)//12//128)
Palettes = {}
i = 0
#print('bestclr_keys: ', bestclr_keys)
url = 'https://dreamdemo.pythonanywhere.com/palletes'
#valid_data = {'seshid': str(sesh.seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'bestclr_keys':bestclr_keys}
#valid_data = {'seshid': str(sesh.seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'counts_srtd_rgb':counts_srtd_rgb}
valid_data = {'seshid': str(seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'counts_srtd_rgb':counts_srtd_rgb}
print('MAKE PALLETE SESHID: ', seshid, sesh.seshid)
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
#print('json requests response: ', str({k:(type(v), None if type(v) != type(dict({})) or not v else (type(list(v.items())[0][0]), type(list(v.items())[0][1]))) for k,v in valid_data.items()}))
#print('json requests response: ', str({k:(type(v), None if type(v) != type(dict({})) or not v else (type(list(v.items())[0][0]), type(list(v.items())[0][1]))) for k,v in data.items()}))
r = requests.post(url, data=json.dumps(valid_data), headers=headers)
#jsondata = r.json()
jsondata = json.loads(r.content)
print('\npalette json requests response: ', str(r.content), '\njson data: ', jsondata )
"""for c in combos:
try:
Palettes_ = [all_palette_data['palette_ids'][k] for k,v in Palette_match_map[bestclr_keys[c[0]]][bestclr_keys[c[1]]].items() if v == dark_light_bool]
random_idxs = list(range(len(Palettes_))) if len(Palettes_) < 8 else random.sample(list(range(len(Palettes_))), 7)
for idx in random_idxs:
Palette_signature = sum([v for rgb in Palettes_[idx] for v in rgb])
if Palette_signature in Palette_accounting:
continue
i = str(len(Palette_out)+1)
sesh.Palettes[sesh.img_id][i] = (Palettes_[idx], ['black' if sum(Palettes_[idx][0]) == 0 else getRGBColorName(Palettes_[idx][0]), 'black' if sum(Palettes_[idx][0]) == 0 else getRGBColorName(Palettes_[idx][1]), 'black' if sum(Palettes_[idx][0]) == 0 else getRGBColorName(Palettes_[idx][2]), 'black' if sum(Palettes_[idx][0]) == 0 else getRGBColorName(Palettes_[idx][3])])
newimg = np.zeros((200,200,3))
newimg[:50,:] = Palettes_[idx][0]
newimg[50:100,:] = Palettes_[idx][1]
newimg[100:150,:] = Palettes_[idx][2]
newimg[150:,:] = Palettes_[idx][3]
Palette_out.append((newimg.astype(np.uint8), i))
Palette_accounting[Palette_signature] = None
except:
try: #swap c[0],c[1] -> c[1],c[0]
Palettes_ = [all_palette_data['palette_ids'][k] for k,v in Palette_match_map[bestclr_keys[c[1]]][bestclr_keys[c[0]]].items() if v == dark_light_bool]
random_idxs = list(range(len(Palettes_))) if len(Palettes_) < 8 else random.sample(list(range(len(Palettes_))), 7)
for idx in random_idxs:
Palette_signature = sum([v for rgb in Palettes_[idx] for v in rgb])
if Palette_signature in Palette_accounting:
continue
i = str(len(Palette_out)+1)
sesh.Palettes[sesh.img_id][i] = (Palettes_[idx], ['black' if sum(Palettes_[idx][0]) == 0 else getRGBColorName(Palettes_[idx][0]), 'black' if sum(Palettes_[idx][0]) == 0 else getRGBColorName(Palettes_[idx][1]), 'black' if sum(Palettes_[idx][0]) == 0 else getRGBColorName(Palettes_[idx][2]), 'black' if sum(Palettes_[idx][0]) == 0 else getRGBColorName(Palettes_[idx][3])])
newimg = np.zeros((200,200,3))
newimg[:50,:] = Palettes_[idx][0]
newimg[50:100,:] = Palettes_[idx][1]
newimg[100:150,:] = Palettes_[idx][2]
newimg[150:,:] = Palettes_[idx][3]
Palette_out.append((newimg.astype(np.uint8), i))
Palette_accounting[Palette_signature] = None
except:
continue"""
Palette_out = []
palettes_data = [cdata[0] for cdata in jsondata['got']]
sesh.palettes_data = {str(idx+1):cdata for idx,cdata in enumerate(palettes_data)}
#print('palettes_data: ', type(palettes_data), palettes_data)
for idx,cdata in enumerate(palettes_data):
newimg = np.zeros((200,200,3))
newimg[:50,:] = cdata[0]
newimg[50:100,:] = cdata[1]
newimg[100:150,:] = cdata[2]
newimg[150:,:] = cdata[3]
Palette_out.append((newimg.astype(np.uint8), str(idx+1)))
#print('Palettes keys: ', sesh.Palettes[sesh.img_id].keys(), type(list(sesh.Palettes[sesh.img_id])[0]))
#print('Palettes: ', counts_srtd_rgb, bestclr_keys, i, len(sesh.Palettes[sesh.img_id]))
#print('Palettes: ', counts_srtd_rgb, bestclr_keys, len(sesh.Palettes[sesh.img_id]), sesh.Palettes[sesh.img_id][0], sesh.Palettes[sesh.img_id][1], sesh.Palettes[sesh.img_id][2])
#return sesh.img_data[sesh.img_id], sesh.img_data[sesh.img_id], sesh.img_data[sesh.img_id], Palette_out
"""sesh.Paletteid = str(len(sesh.Palettes[sesh.img_id])-1)
sesh.Palette_ids[sesh.current_img_signature] = sesh.Paletteid
sesh.Palette_img = np.zeros((200,200,3)).astype(np.uint8)
sesh.Palette_img[:50,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][0]
sesh.Palette_img[50:100,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][1]
sesh.Palette_img[100:150,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][2]
sesh.Palette_img[150:,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][3]"""
sesh.Paletteid = '1' #str(len(palettes_data)-1)
sesh.Palette_ids[sesh.current_img_signature] = sesh.Paletteid
sesh.Palette_img = np.zeros((200,200,3)).astype(np.uint8)
sesh.Palette_img[:50,:] = palettes_data[0][0]
sesh.Palette_img[50:100,:] = palettes_data[0][1]
sesh.Palette_img[100:150,:] = palettes_data[0][2]
sesh.Palette_img[150:,:] = palettes_data[0][3]
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
display = updateItemDisplay(seshid)
sesh.Palettes_displayed[sesh.current_img_signature] = Palette_out
sesh.room_img_loaded = True
return Palette_out, sesh.img_data[sesh.img_id], display
#directory
def set_Palette(evt: gr.SelectData):
sesh.Paletteid = evt.value['caption']
sesh.Palette_img = np.zeros((200,200,3)).astype(np.uint8)
sesh.Palette_img[:50,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][0]
sesh.Palette_img[50:100,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][1]
sesh.Palette_img[100:150,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][2]
sesh.Palette_img[150:,:] = sesh.Palettes[sesh.img_id][sesh.Paletteid][0][3]
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
sesh.Palette_ids[sesh.img_id] = sesh.Paletteid
"""files_ = list(files)
filtered_files_per_color = {c: list(files) for c in sesh.Palettes[sesh.img_id][sesh.Paletteid][1]}
for color in sesh.Palettes[sesh.img_id][sesh.Palette_ids[sesh.img_id]][1]:
substrs = color.split()
temp_files = []
for f in filtered_files_per_color[color]:
if substrs and substrs[0].lower() in f.lower() and (len(substrs)==1 or substrs[1] in f.lower()):
temp_files.append(f)
filtered_files_per_color[color] = list(temp_files)
sesh.filtered_files[sesh.img_id] = filtered_files_per_color
#print('set_Palette: ', [(c, len(sesh.filtered_files[sesh.img_id][c]), sesh.filtered_files[sesh.img_id][c][:3], sesh.filtered_files[sesh.img_id][c][-3:]) for c in sesh.Palettes[sesh.img_id][sesh.Paletteid][1]], sesh.Palettes[sesh.img_id][sesh.Paletteid])"""
def set_style(evt: gr.SelectData):
label = evt.value['caption'].lower().split()[0]
sesh.room_type = label
images = [(v['bedroom'] if label == 'bedroom' else v['living room'], k) for k,v in styles_images.items()]
sesh.items = items = bed_layout_new if label == 'bedroom' else living_layout_new
print('set_style: ', items)
sesh.filtered_files_room[sesh.img_id] = {color: [f for f in cfiles if any([(lambda substrs, f: substrs and substrs[0].lower() in f.lower() and (len(substrs)==1 or substrs[1] in f.lower()))(item.replace('-', ' ').split(), f) for item in items])] for color,cfiles in sesh.filtered_files[sesh.img_id].items()}
room_items_imgs_tuples = [((sesh.Palette_img if item == 'Palette' else sesh.img_data[sesh.img_id]) if item in ['Palette', 'Living Room', 'Bedroom'] else room_item_placeholder_images_dict['BEDROOM FURNITURE' if label == 'bedroom' else 'LIVING ROOM FURNITURE'][item], item) for item in items]
return images, gr.Radio(['Full', 'Queen', 'King'], value='Full', label='Bed Size', interactive=True, visible=True) if label == 'bedroom' else gr.Radio(visible=False), gr.Gallery(room_items_imgs_tuples, label='Room Items', columns=5)
def applyStyle(evt: gr.SelectData):
design_style = evt.value['caption'].lower().split()[0]
sesh.filtered_files_style[sesh.img_id] = {color: [f for f in cfiles if any([(lambda substrs, f: substrs and substrs[0].lower() in f.lower() and (len(substrs)==1 or substrs[1] in f.lower()))(substr.replace('-', ' ').split(), f) for substr in design_style.split()])] for color,cfiles in sesh.filtered_files_room[sesh.img_id].items()}
room_items_imgs_tuples = []
for item in sesh.items:
for color,cfiles in sesh.filtered_files_style[sesh.img_id].items():
for f in cfiles:
if item.split()[-1].lower() in f:
if item not in sesh.activated_items[str(img.sum())]:
sesh.activated_items[sesh.img_id][item] = []
with open(directory+f, 'r') as openfile:
data = json.load(openfile)
sesh.activated_items[sesh.img_id][item] += data
room_items_imgs_tuples = [((sesh.Palette_img if item == 'Palette' else sesh.img_data[sesh.img_id]) if item in ['Palette', 'Living Room', 'Bedroom'] else room_item_placeholder_images_dict['BEDROOM FURNITURE' if sesh.room_type == 'bedroom' else 'LIVING ROOM FURNITURE'][item], item) for item in sesh.items]
return gr.Gallery(room_items_imgs_tuples, label='Room Items', columns=5)
def roomItemClick(evt: gr.SelectData, seshid):
selection = evt.value['caption'].lower()
seshidtype = '...'+str(type(seshid))+ '...'
seshid_ = '...'+str(seshid)+ '...'
seshid = str(time.time()) if not seshid or seshid == 'SESHID' else seshid
sesh.clicked_displayed_product = evt.value['caption']
if selection == 'palette':
return gr.Column(scale=4), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.Gallery(visible=False), gr.Label('Dream Home: As Quick As A Click. As Simple As Shopping.', label='Sponsors'), gr.update(visible=bool(0)), seshid
elif selection in ['living room', 'bedroom']:
return gr.Column(scale=4), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.Gallery(visible=False), gr.Label('Dream Home: As Quick As A Click. As Simple As Shopping.', label='Sponsors', visible=True) if sesh.summary_closed else gr.Label('Dream Home: As Quick As A Click. As Simple As Shopping.', label='Sponsors', visible=False), gr.update(visible=bool(0)) if sesh.summary_closed else gr.update(visible=bool(1)), seshid
else:
try:
item = evt.value['caption']
replacements = [(product['img'] if itemi in sesh.inbudget[sesh.current_img_signature][item] else sesh.default_img, product['price']) for itemi,product in enumerate(sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item])]
return gr.Column(scale=4), gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.Gallery(replacements, 'Item Replacements', rows=1, columns=7, visible=True, interactive=True, height=150), gr.Label(visible=False), gr.update(visible=bool(0)), seshid
except:
return gr.Column(scale=5), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.Gallery([], 'Item Replacements', rows=1, columns=7, visible=False, interactive=True, height=150), gr.Label(visible=True), gr.update(visible=bool(0)), seshid
#sesh.summary_closed
#[items_display, item_side, room_side, colors_side, replace, ads, store_summary]
def closeSidePanel():
return gr.Column(scale=5), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.Label('No Item Selected', label='Merchant'), gr.Gallery(visible=False), gr.Label('Dream Home: As Quick As A Click. As Simple As Shopping.', label='Sponsors', visible=True), gr.update(visible=bool(0))
def productClick(evt: gr.SelectData):
if not sesh.clicked_displayed_product:
return gr.Label('No Item Selected', label='Merchant')
product_idx = evt.index
sesh.product_idx = evt.index
product = sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][sesh.clicked_displayed_product][product_idx]
sesh.product = product
return gr.Label(product['store'].split('-')[0], label='Merchant')
def replaceProduct():
item_idx = sesh.items.index(sesh.clicked_displayed_product)
sesh.updated_display[item_idx] = (sesh.product['img'], sesh.clicked_displayed_product)
#sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item_idx] = (sesh.product_idx, sesh.clicked_displayed_product) if sesh.product_idx in sesh.inbudget[sesh.current_img_signature][sesh.clicked_displayed_product] else sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][item_idx]
sesh.display_items_[sesh.current_img_signature][item_idx] = (sesh.product_idx, sesh.clicked_displayed_product) if sesh.product_idx in sesh.inbudget[sesh.current_img_signature][sesh.clicked_displayed_product] else sesh.display_items_[sesh.current_img_signature][item_idx]
for item_dataidx in sesh.display_items_[sesh.current_img_signature]:
if item_dataidx[0] != -1:
store = sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Palette_ids[sesh.current_img_signature]][item_dataidx[1]][item_dataidx[0]]['store']
writeForStoreProcessing(store, sesh.zipcode)
#sesh.summary[sesh.current_img_signature] = [() if itemidx_item[1] in ['Palette', 'Living Room', 'Bedroom'] else (itemidx_item[1], sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][itemidx_item[1]][itemidx_item[0]]) for itemidx_item in sesh.display_items[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid]]
sesh.summary[sesh.current_img_signature] = [() if itemidx_item[1] in ['Palette', 'Living Room', 'Bedroom'] else (itemidx_item[1], sesh.item_data[sesh.current_img_signature][sesh.room_type][sesh.room_style][sesh.price][sesh.Paletteid][itemidx_item[1]][itemidx_item[0]]) for itemidx_item in sesh.display_items_[sesh.current_img_signature]]
summarisePerStore()
#print('replaceProduct: ', sesh.product_idx, sesh.clicked_displayed_product, sesh.product_idx in sesh.inbudget[sesh.current_img_signature][sesh.clicked_displayed_product], sesh.display_items_, sum([float(item_product[1]['price'].replace('$', '').replace(',', '')) for img in sesh.summary for item_product in sesh.summary[img] if item_product]))
return gr.Column(scale=5), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.Label('No Item Selected', label='Merchant'), gr.Gallery(visible=False), gr.Label('Dream Home: As Quick As A Click. As Simple As Shopping.', label='Sponsors', visible=True), gr.Gallery(sesh.updated_display, label='Room Items', columns=5)
def selectMerchantItemCountAndTotal(store):
num_items = 0
total = 0
for item in sesh.summary_joined[store]:
for description in sesh.summary_joined[store][item]:
price = sesh.summary_joined[store][item][description]['product_dict']['price']
count = sesh.summary_joined[store][item][description]['count']
total += float(price.replace('$', '').replace(',', '')) * count
num_items += count
return num_items, total
def selectMerchantItemCountAndTotal(store):
num_items = 0
total = 0
for item in sesh.summary_joined[store]:
price = sesh.summary_joined[store][item]['product_dict']['price']
count = sesh.summary_joined[store][item]['count']
total += float(price.replace('$', '').replace(',', '')) * count
num_items += count
return num_items, total
from huggingface_hub import InferenceClient
def retrieveProcessedStoreData(store):
if os.path.isfile(f'C:\\Users\\Wayne\\Documents\\store_processors\\completed_{store+sesh.zipcode}.json'):
with open(f'C:\\Users\\Wayne\\Documents\\store_processors\\completed_{store+sesh.zipcode}.json', 'r') as file:
data = json.load(file)
return data['store_data']
else:
return []
def summaryClick():
#from pathlib import Path
sesh.counts_totals = {store:selectMerchantItemCountAndTotal(store) for store in sesh.summary_joined}
all_counts = str(sum([ct[0] for store,ct in sesh.counts_totals.items()]))
all_totals = sum([ct[1] for store,ct in sesh.counts_totals.items()])
print('summaryClick -- counts_totals: ', all_counts, all_totals, sesh.counts_totals)
if sesh.summary_closed:
sesh.summary_closed = False
#descriptions = '\n\n'.join(['Store: '+store+'\n\n'.join(['\n\tProduct: '+ product +'\n\tDescription: '+pd_count['product_dict']['description']+'\n\tPrice: '+pd_count['product_dict']['price'] for product,pd_count in sesh.summary_joined[store].items()]) for store in sesh.summary_joined])
#response = client.text_generation("PRODUCTS: \n\n"+descriptions+"\n\nTask: Referencing the PRODUCTS provided, create an audio script about online shopping to decorate a room; write in the past tense, like we have already decorated and are now reviewing the items chosen to outfit the room. Write in light-hearted and optimistic style.", model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=1500)
#print('summaryClick -- descriptions: ', descriptions)
store_data = {store: (lambda data: '' if not data or store.split()[0].lower() not in data[0]['STORE'].lower() or 'ZIPCODE' not in data[0] or 'PHONE' not in data[0] or 'STATE' not in data[0] or data[0]['STATE'] != sesh.state or len(data[0]['STATE']) != 2 or len(data[0]['PHONE']) != 12 else '\n'.join(['\n'.join([('\t\t\t'+key if key.lower() != 'store' else '\t\tNAME')+': '+value for key,value in d.items()]) for d in data]))(retrieveProcessedStoreData(store)) for store in sesh.summary_joined}
#store_data = {store: (lambda data: '' if not data or 'zipcode' not in data[0] else '\n'.join([str(d) for d in data]))(retrieveProcessedStoreData(store)) for store in sesh.summary_joined}
item_summary_data = '\n\n'.join(['STORE: '+store+'\n'+('\tLOCATIONS: N/A' if not store_data[store] else '\tLOCATIONS: \n'+store_data[store])+''.join(['\n\tPRODUCT: '+ product +'\n\tPRICE: '+pd_count['product_dict']['price']+'\n\tSOURCE: '+pd_count['product_dict']['href'] for product,pd_count in sesh.summary_joined[store].items()]) for store in sesh.summary_joined])
print('store summary: ', {store: retrieveProcessedStoreData(store) for store in sesh.summary_joined})
return gr.Button('Suppress Summary'), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.Dropdown(list(sesh.summary_joined), label='Merchants', interactive=True), gr.Label('All', label='Merchant'), gr.Label(all_counts, label='Number of Items'), gr.Label('$'+str(np.round(all_totals, 2)), label='Total'), item_summary_data
#'\n\n'.join(['Store: '+store+'\n\n'+'\n\n'.join(['\n\tProduct: '+ product +'\n\tPrice: '+pd_count['product_dict']['price']+'\n\tSource: '+pd_count['product_dict']['href'] for product,pd_count in sesh.summary_joined[store].items()]) for store in sesh.summary_joined])
else:
sesh.summary_closed = True
return gr.Button('Summarise'), gr.update(visible=bool(1)), gr.update(visible=bool(1)), gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.Dropdown(), gr.Label(), gr.Label(), gr.Label(), ''
#sesh.summary_joined[store]['total'], num_items
#[summary_button, design_accordion, update_accordion, room_ad, summary_group, replace, ads, store_summary]
#self.complete_summary
#selectMerchantProduct, None, [product_dropdown, total, num_of_items]
def selectMerchantProduct(evt: gr.SelectData):
store = evt.value
sesh.summary_store = store
#print('selectMerchantProduct -- counts_totals: ', counts_totals)
return gr.Dropdown(list(sesh.summary_joined[store]), label='Items', interactive=True), gr.Label(sesh.summary_store if sesh.summary_store else 'All', label='Merchant'), gr.Label(str(sesh.counts_totals[store][0]), label='Number of Items'), gr.Label('$'+str(np.round(sesh.counts_totals[store][1], 2)), label='Total')
def getVizText(html):
from bs4 import BeautifulSoup, NavigableString, Tag
soup = BeautifulSoup(str(html), 'html.parser')
viz_text = [tag.text for tag in soup.find_all() if tag.text and len(tag.find_all())==0 and tag.name not in ['style', 'script', 'head', 'title', 'meta', '[document]'] and not isinstance(tag, NavigableString)]
viz_text_str = '...'.join(viz_text).replace('\\n', '').replace('\\t', '').replace('\n', '').replace('\t', '')
return viz_text_str
def findShoppingRelevantTerms(html):
if not html:
return {}
try:
start = time.time()
print('findShoppingRelevantTerms: getting viztext')
viz_text_str = getVizText(str(html.decode("utf-8")))
print('findShoppingRelevantTerms -- got viztext: ', time.time()-start)
search_terms = [' off ', ' availability ', ' available ', ' delivery ', ' deliver ', ' ship ', ' shipping ', ' return ', ' returns ', ' exchange ', ' exchanges ', ' material ', ' materials ']
print('findShoppingRelevantTerms: getting found_terms')
start = time.time()
#found_terms = {t:(lambda text, term_loc: text[term_loc-200:term_loc+300])(viz_text_str, viz_text_str.lower().find(t.lower())) for t in search_terms if t in viz_text_str}
found_terms = {t:(lambda text, term_loc: text[term_loc-500:term_loc+500])(viz_text_str, viz_text_str.lower().find(t.lower())) for t in search_terms if (lambda text, term_loc: (t != ' off ' and t in text[term_loc-500:term_loc+500]) or (t == ' off ' and (t in text[term_loc-500:term_loc+500] or ' off...' in text[term_loc-500:term_loc+500]) and ('%' in text[term_loc-500:term_loc+500] or '$' in text[term_loc-500:term_loc+500])))(viz_text_str, viz_text_str.lower().find(t.lower()))}
print('findShoppingRelevantTerms -- got found_terms: ', time.time()-start)
return found_terms
except:
return {}
def changeSummaryFilter(evt: gr.SelectData):
summary_radio = evt.value
print('changeSummaryFilter: ', summary_radio)
sesh.summary_radio = summary_radio
all_counts = str(sum([ct[0] for store,ct in sesh.counts_totals.items()]))
all_totals = sum([ct[1] for store,ct in sesh.counts_totals.items()])
#if summary_radio == 'Complete' or not hasattr(sesh, 'summary_store'):
if summary_radio == 'Complete':
print('changeSummaryFilter: in Complete')
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))
elif summary_radio == 'Script':
#textgen for general audience, things to look out for or be aware of
product_pd_counts = [(product,pd_count) for store in sesh.summary_joined for product,pd_count in sesh.summary_joined[store].items()]
urls = [product_pd_count[1]['product_dict']['href'] for product_pd_count in product_pd_counts]
start = time.time()
responses = asyncio.run(main(urls))
end = time.time()
lapse = end-start
fdsdweesdd = findShoppingRelevantTerms(responses[0])
print('changeSummaryFilter -- in Script: ', lapse, fdsdweesdd)
start = time.time()
found_terms_4_room_items = [(product_pd_counts[ir][0], findShoppingRelevantTerms(r)) for ir,r in enumerate(responses)]
del responses
#dsdsd = 'ITEM TOPICS: \n\n'+'\n\n'.join(['ITEM : '+data[0].upper() + f'\n\n{data[0].upper()} TOPICS: \n'+'\n\n'.join(['Topic: '+term[1:-1].upper()+'\n...'+text for term,text in data[1].items()]) for idx,data in enumerate(found_terms_4_room_items ) if data[1]])
start = time.time()
topics = 'ITEM TOPICS: \n\n'+'\n\n'.join(['\n\n'.join([f'{data[0].upper()} TOPIC: '+term[1:-1].upper()+'\n...'+text for term,text in data[1].items()]) for idx,data in enumerate(found_terms_4_room_items ) if data[1]])
descriptions = '\n\n'+'\n\n'.join(['Store: '+store+'\n\n'.join(['\n\tProduct: '+ product.upper() +'\n\tDescription: '+pd_count['product_dict']['description']+'\n\tPrice: '+pd_count['product_dict']['price'] for product,pd_count in sesh.summary_joined[store].items()]) for store in sesh.summary_joined])
prompt = topics + "\n\nITEMS: \n\n"+descriptions+"\n\nTask: Referencing the ITEMS provided, create an audio script about shopping to decorate a room, writing to prompt the listener for their feedback as to whether the items chosen are choices they might have made; where applicable, incorporate the corresponding ITEM TOPICS to the ITEM being written about, and do so in a way that is informing the listener of what they might expect during the ordering process -- reference the ITEM TOPICS in a fun way as if you are engaging in small talk, making remarks to the respective ITEM TOPICS in a 'just a heads up' tangent and then getting back on script. Write in the past tense, like we have already decorated and are now reviewing the items chosen to outfit the room, speculating as to the listener's stance on the items chosen, whether they would like the ITEM being spoken about and why (be creative, thinking of random reasons the listener would or would not like the ITEM chosen). Write in an informal style. Keep in mind, the items have NOT been ordered and shipped yet."
items_prepped = ['\n\n'.join([f'ITEM: {data[0].upper()}\n\n'+f'{data[0].upper()} STORE: '+product_pd_counts[idx][1]['product_dict']['store']+'\n\n'+f'{data[0].upper()} DESCRIPTION: '+product_pd_counts[idx][1]['product_dict']['description']+'\n\n'+'\n\n'.join([f'{data[0].upper()} TOPIC: '+(term[1:-1].upper() if term[1:-1] != 'ship' else 'SHIPPING')+'\n...'+text for term,text in data[1].items()])]) for idx,data in enumerate(found_terms_4_room_items)]
#print('indivij prep: ', items_prepped , len(items_prepped))
templates = {0:['For ITEM, we went with the ITEM DESCRIPTION. SPECULATED RESPONSE.', 'SPECULATED RESPONSE, so for ITEM we went with the ITEM DESCRIPTION.'], 1:['For ITEM, we went with the ITEM DESCRIPTION. ITEM TOPIC. SPECULATED RESPONSE.', 'SPECULATED RESPONSE, so for ITEM we went with the ITEM DESCRIPTION. ITEM TOPIC.'], 2:['For ITEM, we went with the ITEM DESCRIPTION. ITEM TOPICS. SPECULATED RESPONSE.', 'SPECULATED RESPONSE, so for ITEM we went with the ITEM DESCRIPTION. ITEM TOPICS.']}
responses = []
for idx,data in enumerate(found_terms_4_room_items):
template = templates[len(data[1]) if len(data[1])<2 else 2][np.random.choice([0,1])]
prompt = items_prepped[idx]+'\n\nTEMPLATE: '+template+"\n\nTASK: adapt TEMPLATE using the ITEM/DESCRIPTION/STORE info provided, where SPECULATED RESPONSE is your creative guess as to the reader's stance on the items chosen, whether they would like the ITEM being written about and why (be creative, thinking of random reasons the reader would or would not like the ITEM chosen). Write from the perspective of reporting to someone who is considering purchasing a home and you are presenting different decorative options that might persuade them to buy the home; so, make sure your wording reflects this -- 'if you go with...', 'now keep in mind...', 'were you to purchase this home...' and the like are examples of how you might word things. You don't have to use these examples exactly, just word things similarly. Be creative."
if data[1]:
prompt += " Incorporate each ITEM TOPIC in a way that is a heads up for the reader to inform them of the purchase process and what they can expect. Reference the each ITEM TOPIC in a fun way as if you are engaging in small talk, making remarks to the respective ITEM TOPIC info in a 'just a heads up' tangent and then getting back on script."
prompt += f" This should read as a review of an item chosen for a room being furnished, but the item has NOT been purchased or shipped yet. Write in an informal style. And to clarify, you are writing AS a reviewer, FOR a prospective home buyer, ABOUT an item FROM a store, and the likely buying experience with them (the store); you are writing about decorating a {sesh.room_type}. "
if idx==0:
prompt += "Keep in mind this is the first of many items we are reviewing, so ensure your writing reflects the fact that this is just the first item being reported on."
elif idx==len(found_terms_4_room_items)-1:
prompt += "Keep in mind this is the last of many items we are reviewing, so ensure your writing reflects the fact that this is the final item being reported on and do a review wrap-up/send off for this particular room's decor review. Maybe begin by writing something along the lines of 'Okay lastly we have the...' or 'Well, our final item is...' or what have you jare examples of how you might word things. You don't have to use these examples exactly, just word things similarly. Be creative.."
else:
prompt += "Keep in mind this is one of many items we have already reviewed and one of other yet to be reviewed, so ensure your writing reflects the fact that this is just the next item being reported on. Maybe begin by writing something along the lines of 'Okay now we have...' or 'So next up is...' or what have you are examples of how you might word things. You don't have to use these examples exactly, just word things similarly. Be creative."
response = client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
response = response.replace("I know what you're thinking", np.random.choice(alarm3)).replace("I know what you are thinking", np.random.choice(alarm3))
print('script response: ', response)
responses.append(response)
time.sleep(.7)
response = client.text_generation('\n\n'.join(responses)+"\n\nTASK: summarize this script for a tiktok video about a prospective homebuyer decorating this {sesh.room_type} should they purchase the home. The review should cover the following topics: { ', '.join([data[0] for idx,data in enumerate(found_terms_4_room_items)])}", model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
print('\n\ntiktok response: ', response)
response = client.text_generation('\n\n'.join(responses)+"\n\nTASK: summarize this script for a youtube short about a prospective homebuyer decorating this {sesh.room_type} should they purchase the home. The review should cover the following topics: {', '.join([data[0] for idx,data in enumerate(found_terms_4_room_items)])}", model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
print('\n\nyoutube short response: ', response) #script response:
preprompt = 'ITEMS: \n\n'+'\n\n'.join(['\n\n'.join([f'ITEM: {data[0].upper()}\n\n'+f'{data[0].upper()} STORE: '+product_pd_counts[idx][1]['product_dict']['store']+'\n\n'+f'{data[0].upper()} DESCRIPTION: '+product_pd_counts[idx][1]['product_dict']['description']+'\n\n'+'\n\n'.join([f'{data[0].upper()} TOPIC: '+term[1:-1].upper()+'\n...'+text for term,text in data[1].items()])]) for idx,data in enumerate(found_terms_4_room_items)])
#pddsdf = [(idx,data[0]) for idx,data in enumerate(found_terms_4_room_items)]
#pddsdfassas = [(idx,data[0]) for idx,data in enumerate(found_terms_4_room_items) if data[1]]
#print('preprompt: ', len(found_terms_4_room_items), pddsdf, pddsdfassas, preprompt)
prompt = preprompt+"\n\nTask: Referencing the ITEMS provided -- each item DESCRIPTION, in particular -- create an audio script about shopping to decorate a room, writing to prompt the listener for their feedback as to whether the items chosen are choices they might have made; where applicable, incorporate the corresponding ITEM TOPICS to the item DESCRIPTION being written about, and do so in a way that is informing the listener of what they might expect during the ordering process. Reference the ITEM TOPICS in a fun way as if you are engaging in small talk, making remarks to the respective ITEM TOPIC in a 'just a heads up' tangent and then getting back on script. Write in the past tense, like we have already decorated and are now reviewing the items chosen to outfit the room, speculating as to the listener's stance on the items chosen, whether they would like the ITEM being spoken about and why (be creative, thinking of random reasons the listener would or would not like the ITEM chosen). Write in an informal style."
#response = client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
end = time.time()
#print('changeSummaryFilter -- in Script: ', lapse, end-start, response)
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))
else:
#print('changeSummaryFilter: in Merchant')
return gr.Label(sesh.summary_store if hasattr(sesh, 'summary_store') and sesh.summary_store else 'All', label='Merchant'), gr.Label(str(sesh.counts_totals[sesh.summary_store][0]) if hasattr(sesh, 'summary_store') and sesh.summary_store else '--', label='Number of Items'), gr.Label('$'+str(np.round(sesh.counts_totals[sesh.summary_store][1], 2)) if hasattr(sesh, 'summary_store') and sesh.summary_store else '--', label='Total'), gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1))
#[merchant_top, total, num_of_items, product_summary, complete_source_breakdown, budget_row, store_dropdown]
def displaySource(evt: gr.SelectData):
product = evt.value
sesh.summary_product = product
#sources = '\n\n'.join(['Price: '+pd_count['product_dict']['price']+'\n\nSource: '+pd_count['product_dict']['href'] for description_key,pd_count in sesh.summary_joined[sesh.summary_store][product].items()])
sources = 'Price: '+sesh.summary_joined[sesh.summary_store][product]['product_dict']['price']+'\n\nSource: '+sesh.summary_joined[sesh.summary_store][product]['product_dict']['href']
return gr.Markdown(sources), gr.Number(value=sesh.summary_joined[sesh.summary_store][product]['count'], label='Item Count', minimum=0)
#sesh.summary_joined[store][item][pd['description']] = {'product_dict': pd, 'count':1}
#sesh.summary_joined[store][item] = {'product_dict': pd, 'count':1}
def updateProductCount(count):
sesh.summary_joined[sesh.summary_store][sesh.summary_product]['count'] = count
sesh.counts_totals = {store:selectMerchantItemCountAndTotal(store) for store in sesh.summary_joined}
all_counts = str(sum([ct[0] for store,ct in sesh.counts_totals.items()]))
all_totals = sum([ct[1] for store,ct in sesh.counts_totals.items()])
return gr.Label(str(sesh.counts_totals[sesh.summary_store][0]) if sesh.summary_store and sesh.summary_radio != 'Complete' else all_counts, label='Number of Items'), gr.Label('$'+str(np.round(sesh.counts_totals[sesh.summary_store][1], 2)) if sesh.summary_store and sesh.summary_radio != 'Complete' else '$'+str(np.round(all_totals, 2)), label='Total')
def updateBudget(budget_number, seshid):
sesh.budget_number = float(budget_number)
#sesh.item_budgets = {img: {item: int(weight*sesh.budget_number) for item,weight in weights.items()} for img,weights in sesh.product_means_weights.items()}
#print('updateBudget: ', sesh.budget_number, sesh.item_budgets)
display = updateItemDisplay(seshid, budget=True)
sesh.counts_totals = {store:selectMerchantItemCountAndTotal(store) for store in sesh.summary_joined}
all_counts = str(sum([ct[0] for store,ct in sesh.counts_totals.items()]))
all_totals = sum([ct[1] for store,ct in sesh.counts_totals.items()])
return display, gr.Label(all_counts, label='Number of Items'), gr.Label('$'+str(np.round(all_totals, 2)), label='Total')
#updateBudget, budget, room_items
def showPalettes():
return gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.update(visible=bool(0))
def showScripts():
return gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.update(visible=bool(0)), 'load'
def showJourneys():
return gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1))
templates = {0:['For ITEM, we went with the ITEM DESCRIPTION. SPECULATED RESPONSE.', 'SPECULATED RESPONSE, so for ITEM we went with the ITEM DESCRIPTION.'], 1:['For ITEM, we went with the ITEM DESCRIPTION. ITEM TOPIC. SPECULATED RESPONSE.', 'SPECULATED RESPONSE, so for ITEM we went with the ITEM DESCRIPTION. ITEM TOPIC.'], 2:['For ITEM, we went with the ITEM DESCRIPTION. ITEM TOPICS. SPECULATED RESPONSE.', 'SPECULATED RESPONSE, so for ITEM we went with the ITEM DESCRIPTION. ITEM TOPICS.']}
def makeItemPrompt(idx,data):
template = templates[len(data[1]) if len(data[1])<2 else 2][np.random.choice([0,1])]
prompt = sesh.items_prepped[idx]+'\n\nTEMPLATE: '+template+"\n\nTASK: adapt TEMPLATE using the ITEM/DESCRIPTION/STORE info provided, where SPECULATED RESPONSE is your creative guess as to the reader's stance on the items chosen, whether they would like the ITEM being written about and why (be creative, thinking of random reasons the reader would or would not like the ITEM chosen). Write from the perspective of reporting to someone who is considering purchasing a home and you are presenting different decorative options that might persuade them to buy the home; so, make sure your wording reflects this -- 'if you go with...', 'now keep in mind...', 'were you to purchase this home...' and the like are examples of how you might word things. You don't have to use these examples exactly, just word things similarly. Be creative."
if data[1]:
prompt += " Incorporate each ITEM TOPIC in a way that is a heads up for the reader to inform them of the purchase process and what they can expect. Reference the each ITEM TOPIC in a fun way as if you are engaging in small talk, making remarks to the respective ITEM TOPIC info in a 'just a heads up' tangent and then getting back on script."
prompt += f" This should read as a review of an item chosen for a room being furnished, but the item has NOT been purchased or shipped yet. Write in an informal style. And to clarify, you are writing AS a reviewer, FOR a prospective home buyer, ABOUT an item FROM a store, and the likely buying experience with them (the store); you are writing about decorating a {sesh.room_type}. "
if idx==0:
prompt += "Keep in mind this is the first of many items we are reviewing, so ensure your writing reflects the fact that this is just the first item being reported on, including a proper intro to get started."
elif idx==len(sesh.found_terms_4_room_items)-1:
prompt += "Keep in mind this is the last of many items we are reviewing, so ensure your writing reflects the fact that this is the final item being reported on and do a review wrap-up/send off for this particular room's decor review. Maybe begin by writing something along the lines of 'Okay lastly we have the...' or 'Well, our final item is...' or what have you are examples of how you might word things. You don't have to use these examples exactly, just word things similarly. Be creative."
else:
prompt += "Keep in mind this is the one of many items we have already reviewed and one of other yet to be reviewed, so ensure your writing reflects the fact that this is just the next item being reported on. Maybe begin by writing something along the lines of 'Okay now we have...' or 'So next up is...' or what have you are examples of how you might word things. You don't have to use these examples exactly, just word things similarly. Be creative."
return prompt
def generateScriptForItem(idx,data):
prompt = makeItemPrompt(idx,data)
#tg_response = client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
tg_response = getTextGen(prompt)
tg_response = tg_response.replace("I know what you're thinking", np.random.choice(alarm3)).replace("I know what you're thinking", np.random.choice(alarm3))
sesh.tg_responses.append(tg_response)
def loadColorAndCharacter(text):
if text == 'load':
sesh.product_pd_counts = [(product,pd_count) for store in sesh.summary_joined for product,pd_count in sesh.summary_joined[store].items()]
sesh.tg_responses = []
urls = [product_pd_count[1]['product_dict']['href'] for product_pd_count in sesh.product_pd_counts]
sesh.responses = asyncio.run(main(urls))
return 'loaded'
else:
return 'not loaded'
def searchColorAndCharacter(text):
if text == 'search':
sesh.found_terms_4_room_items = [(sesh.product_pd_counts[ir][0], findShoppingRelevantTerms(r)) for ir,r in enumerate(sesh.responses)]
sesh.found_terms_4_room_items_idx = 0
sesh.scripts = {}
sesh.items_prepped = ['\n\n'.join([f'ITEM: {data[0].upper()}\n\n'+f'{data[0].upper()} STORE: '+sesh.product_pd_counts[idx][1]['product_dict']['store']+'\n\n'+f'{data[0].upper()} DESCRIPTION: '+sesh.product_pd_counts[idx][1]['product_dict']['description']+'\n\n'+'\n\n'.join([f'{data[0].upper()} TOPIC: '+(term[1:-1].upper() if term[1:-1] != 'ship' else 'SHIPPING')+'\n...'+text for term,text in data[1].items()])]) for idx,data in enumerate(sesh.found_terms_4_room_items)]
#item_prompts = [makeItemPrompt(idx,idata) for idx,idata in enumerate(sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])]
#item_scripts = multiprocessPrompts(item_prompts)
#print('searchColorAndCharacter: ', item_scripts)
return 'searched'
else:
return 'not searched'
def updateLinksLoadStatus(text):
if text == 'loaded':
print('LOADED color and character for script\nadding color and character to script\nstandby...')
return 'LOADED color and character for script\nadding color and character to script\nstandby...', 'search'
else:
return 'searched color and character for script\npreparing script for item1\nstandby...update this', ''
def updateLinksSearchStatus(text):
if text == 'searched':
print('ADDED color and character for script\npreparing script for item1\nstandby...')
return f'ADDED color and character for script\npreparing script for {sesh.found_terms_4_room_items[0][0]}\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby......', 'prep1'
else:
return 'searched color and character for script\npreparing script for item1\nstandby...update this', ''
def prepItem1ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem1Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
#print('prepItem1forScript: ', sesh.tg_responses[0])
return f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...', f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem2ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem2Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
#print('prepItem1forScript: ', sesh.tg_responses[0])
return f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...', f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem3ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem3Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
#print('prepItem1forScript: ', sesh.tg_responses[0])
return f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...', f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem4ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem4Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
#print('prepItem1forScript: ', sesh.tg_responses[0])
return f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...', f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem5ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem5Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
#print('prepItem1forScript: ', sesh.tg_responses[0])
return f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...', f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem6ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem6Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
#print('prepItem1forScript: ', sesh.tg_responses[0])
return f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx} of {len(sesh.found_terms_4_room_items)+6}, standby...', f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem7ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem7Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
#print('prepItem1forScript: ', sesh.tg_responses[0])
return f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...', f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem8ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem8Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
print('updateItem8Status: ', sesh.found_terms_4_room_items_idx, len(sesh.found_terms_4_room_items))
sesh.script_status_text = f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...' if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items) else f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for Youtube long-form video.\nWorking on step {sesh.found_terms_4_room_items_idx} of {len(sesh.found_terms_4_room_items)+6}, standby...'
return sesh.script_status_text, f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem9ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem9Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
print('updateItem9Status: ', sesh.found_terms_4_room_items_idx, len(sesh.found_terms_4_room_items))
sesh.script_status_text = f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...' if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items)-1 else sesh.script_status_text
return sesh.script_status_text, f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem10ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem10Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
print('updateItem10Status: ', sesh.found_terms_4_room_items_idx, len(sesh.found_terms_4_room_items))
sesh.script_status_text = f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...' if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items)-1 else sesh.script_status_text
return sesh.script_status_text, f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem11ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem11Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
print('updateItem11Status: ', sesh.found_terms_4_room_items_idx, len(sesh.found_terms_4_room_items))
sesh.script_status_text = f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...' if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items)-1 else sesh.script_status_text
return sesh.script_status_text, f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem12ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem12Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
print('updateItem12Status: ', sesh.found_terms_4_room_items_idx, len(sesh.found_terms_4_room_items))
sesh.script_status_text = f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...' if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items)-1 else sesh.script_status_text
return sesh.script_status_text, f'prep{sesh.found_terms_4_room_items_idx+1}'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
def prepItem13ForScript(text):
if text == f'prep{sesh.found_terms_4_room_items_idx+1}':
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): generateScriptForItem(sesh.found_terms_4_room_items_idx,sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx])
if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items): sesh.found_terms_4_room_items_idx += 1
return f'prepped{sesh.found_terms_4_room_items_idx}'
else:
return f'prep{sesh.found_terms_4_room_items_idx} failed'
def updateItem13Status(text):
if text == f'prepped{sesh.found_terms_4_room_items_idx}':
print('updateItem13Status: ', sesh.found_terms_4_room_items_idx, len(sesh.found_terms_4_room_items))
#print('prepItem13forScript: ', sesh.tg_responses)
sesh.scripts['Base'] = '\n\n'.join(sesh.tg_responses)
sesh.script_status_text = f'{sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx-1][0].upper()} script complete.\nPreparing script for {sesh.found_terms_4_room_items[sesh.found_terms_4_room_items_idx][0]}.\nWorking on step {sesh.found_terms_4_room_items_idx+1} of {len(sesh.found_terms_4_room_items)+6}, standby...' if sesh.found_terms_4_room_items_idx < len(sesh.found_terms_4_room_items)-1 else sesh.script_status_text
return sesh.script_status_text, 'prep_ytlong'
else:
print(f'prepItem{sesh.found_terms_4_room_items_idx+1}ForScript: fail')
return f'ITEM {sesh.found_terms_4_room_items_idx} prep failed', ''
#On-screen text:
def prepYTLongFormScript(text):
if text == 'prep_ytlong':
prompt = 'SCRIPT: \n\n'+'\n\n'.join(sesh.tg_responses)+f'\n\nTASK: rewrite the provided SCRIPT for a long-form Youtube video. Keep in mind the SCRIPT is about reviewing items to potentially have purchased, shipped and decorate a {sesh.room_type}; this is all for a prospective home buyer -- you are the item reviewer who is reviewing items on behalf of the potential home buyer.'
sesh.scripts['Youtube Long-Form'] = getTextGen(prompt) #client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
return 'ytlong_prepped'
else:
return 'prep_ytlong failed'
def updateYTLongFormStatus(text):
if text == 'ytlong_prepped':
print('updateYTLongFormStatus: ', list(sesh.scripts))
return f'YOUTUBE LONG-FORM script complete.\nPreparing script for Youtube short-form.\nWorking on step {sesh.found_terms_4_room_items_idx+2} of {len(sesh.found_terms_4_room_items)+6}, standby...', 'prep_ytshort', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
else:
return 'YT long-form script failed', '', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
def prepYTShortFormScript(text):
if text == 'prep_ytshort':
prompt = 'SCRIPT: \n\n'+'\n\n'.join(sesh.tg_responses)+f'\n\nTASK: rewrite the provided SCRIPT for a Youtube Short. Keep in mind the SCRIPT is about reviewing items to potentially have purchased, shipped and decorate a {sesh.room_type}; this is all for a prospective home buyer -- you are the item reviewer who is reviewing items on behalf of the potential home buyer.'
sesh.scripts['Youtube Short-Form'] = getTextGen(prompt) #client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
return 'ytshort_prepped'
else:
return 'prep_ytshort failed'
def updateYTShortFormStatus(text):
print('updateYTShortFormStatus: ', text, list(sesh.scripts))
if text == 'ytshort_prepped':
return f'YOUTUBE SHORT script complete.\nPreparing script for Facebook.\nWorking on step {sesh.found_terms_4_room_items_idx+3} of {len(sesh.found_terms_4_room_items)+6}, standby...', 'prepfb', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
else:
return 'YT short-form script failed', '', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
def prepFBScript(text):
if text == 'prepfb':
prompt = 'SCRIPT: \n\n'+'\n\n'.join(sesh.tg_responses)+f'\n\nTASK: rewrite the provided SCRIPT for a long-form Facebook video. Keep in mind the SCRIPT is about reviewing items to potentially have purchased, shipped and decorate a {sesh.room_type}; this is all for a prospective home buyer -- you are the item reviewer who is reviewing items on behalf of the potential home buyer.'
sesh.scripts['Facebook Long-Form'] = getTextGen(prompt) #client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
return 'fb_prepped'
else:
return 'prepfb failed'
def updateFBStatus(text):
print('updateFBStatus: ', text, list(sesh.scripts))
if text == 'fb_prepped':
return f'FACEBOOK script complete.\nPreparing script for Instagram Reel.\nWorking on step {sesh.found_terms_4_room_items_idx+4} of {len(sesh.found_terms_4_room_items)+6}, standby...', 'prepig', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
else:
return 'Facebook script failed', '', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
def prepIGScript(text):
if text == 'prepig':
prompt = 'SCRIPT: \n\n'+'\n\n'.join(sesh.tg_responses)+f'\n\nTASK: rewrite the provided SCRIPT for an Instagram Reel video. Keep in mind the SCRIPT is about reviewing items to potentially have purchased, shipped and decorate a {sesh.room_type}; this is all for a prospective home buyer -- you are the item reviewer who is reviewing items on behalf of the potential home buyer.'
sesh.scripts['Instagram Reel'] = getTextGen(prompt) #client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
return 'ig_prepped'
else:
return 'prepig failed'
def updateIGStatus(text):
print('updateIGStatus: ', text, list(sesh.scripts))
if text == 'ig_prepped':
return f'INSTAGRAM REEL script complete.\nPreparing script for TikTok.\nWorking on step {sesh.found_terms_4_room_items_idx+5} of {len(sesh.found_terms_4_room_items)+6}, standby...', 'prep_tiktok', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
else:
return 'IG script failed', '', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
def prepTikTokScript(text):
if text == 'prep_tiktok':
prompt = 'SCRIPT: \n\n'+'\n\n'.join(sesh.tg_responses)+f'\n\nTASK: rewrite the provided SCRIPT for a Tiktok video. Keep in mind the SCRIPT is about reviewing items to potentially have purchased, shipped and decorate a {sesh.room_type}; this is all for a prospective home buyer -- you are the item reviewer who is reviewing items on behalf of the potential home buyer.'
sesh.scripts['Tiktok'] = getTextGen(prompt) #client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
return 'tiktok_prepped'
else:
return 'prep_tiktok failed'
def updateTikTokStatus(text):
print('updateTikTokStatus: ', text, list(sesh.scripts))
if text == 'tiktok_prepped':
return f'TIKTOK script complete.\nPreparing script for LinkedIn.\nWorking on step {sesh.found_terms_4_room_items_idx+6} of {len(sesh.found_terms_4_room_items)+6}, standby...', 'prep_linkedin', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
else:
return 'TikTok script failed', '', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
def prepLinkedInScript(text):
if text == 'prep_linkedin':
prompt = 'SCRIPT: \n\n'+'\n\n'.join(sesh.tg_responses)+f'\n\nTASK: rewrite the provided SCRIPT for a LinkedIn long-form video. Keep in mind the SCRIPT is about reviewing items to potentially have purchased, shipped and decorate a {sesh.room_type}; this is all for a prospective home buyer -- you are the item reviewer who is reviewing items on behalf of the potential home buyer.'
sesh.scripts['LinkedIn'] = getTextGen(prompt) #client.text_generation(prompt, model="mistralai/Mixtral-8x7B-Instruct-v0.1", max_new_tokens=2500)
return 'linkedin_prepped'
else:
return 'prep_linkedin failed'
def updateLinkedInStatus(text):
print('updateLinkedInStatus: ', text, list(sesh.scripts))
if text == 'linkedin_prepped':
return 'All scripts complete.', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
else:
return 'LinkedIn script failed', gr.Dropdown(list(sesh.scripts), label='Scripts', interactive=True)
def selectScript(evt: gr.SelectData):
script = evt.value
return sesh.scripts[script ]
"""
1. speedthrough for the results oriented: personalized staging, purchasable decor
2. creative showcasing
3. quick content creation
4. messaging
5.
why important: difficult for new recruits to communicate value, this makes it easy
what it is:
creative showings
content creation
video/screen recordings with ads, branded collages
could be:
credit balance
dream homes
dream jobs
dreamers to help
hauls/fashion nova for home decor
user-created content
user-directed placement
value creation/creators...easily communicate your value
equity w/out having to give away equity in brokerage (resistance)
equity for recruitment and retention
equity to cashflow any property
the Dreamers brand, value prop: we help your dreams come true--dream home/dream job placement primarily...market maker/dream brokers...employees helping employees
agent ad network basis for this all, the foundation: network is your networth
brand: overwhelm market with goodwill: word of mouth, facilitated dream job placement first, then dream home placement
the road ahead:
positioned to solve various major real estate-related problems:
*cashflowing properties
-win/win: help homeowners solve the number one problem of increasing value of property...cashflow; in return we are preferred buyer/listing agent
*renters paying monthly with no ownership to show for rent paid: funnel/intent (to no longer rent, rdy to buy)
-win/win: renters become owners/landlords receive ad space...in return we create market/demand for our company shares...stock appreciation/our agents realize gains
*dream job/home away from home: intent to buy/sell home...
-win/win: majority of time spent outside home is job related, job is home away from home/have to change jobs to realize raise/not working ideal job...we help them and in return we get holy grail of marketing--intent (to buy/sell property)
what it is:
As: virtual, personalized staging...purchasable decor
As: content creation platform
As: branding platform/recruitment tool/fambiz
As: advertising platform: to communicate value prop
As: wealth preservation/building platform (networth in network)
As: equity comp. vehicle
reasons for leaving job:
benefits
toxic work env.
work-life bal
pay raise
light is weird: https://www.youtube.com/watch?v=QqY8fY0TqaQ
rollo: https://www.youtube.com/watch?v=Bn5Mpp7tBS0
hyatt: https://www.youtube.com/watch?v=h8VX85IR7bQ
latebloom: https://www.youtube.com/watch?v=bZmeEQHOX9A
list with us: want to find that dream job? small business owner looking to grow? receive $50k in endlessideas ad credits to help your ideas find a home when you list your home with us
house hunting: is that home cashflowing? receive $5000/month in ad credits when you buy with us
paid to pay attention
messaging/familiarize with our ecosystem and what it all entails
made to help creatively showcase property...leads to content creation
*****
Me, personally, I am going to have a very difficult time asking buyers for compensation. Also, first time buyers certainly do not have those extra funds.
Exactly. Picture a young newly married couple, looking to make their first purchase, asked to pay many thousands. They can't rub two nickels together most times
VA buyers will not be able to at least under current VA rules
----
Yes the attorney, will look over the contract initially, but will he/she "babysit" the process, making sure you get all your repairs within your due dilligence time frame, watch and fight for your appraisal, protect your earnest money - a skilled Realtor will!
*****
*paid to use service and create content/screen recordings
*those marketed to are rewarded for cooperating (ie hiring someone advertising their job needs)
*greater agent comp pctg for increased ad space
*digital real estate/ad space
*sell credits for less to other platform users/ad buyers; subsidize buyer agent commission for lower ad cost
*“I think everybody rushes to complicate, but the answers are often found in simplicity,” Abrams said.
*In addition to figuring out best practices, Harrelson said agents should be working on how best to present their value to clients.: https://www.housingwire.com/articles/dont-panic-kw-executives-address-agent-questions-on-nar-commission-settlement/
*greater seller incitives for first-time and VA home buyers
*improved agent compensation
*so realtors will go the way of travel agents and we don't see too many of those any more
creative ways of showcasing the property/frictionless content creation
creating motivated sellers
ai/future-proof for agents
future of wealth accumalation/preservation
*value prop/network: consumers don't think middleman is necessary...give incentive to pay commish
help explaining your value/23:05: https://www.youtube.com/watch?v=llE0CzT0ulI
branding/marketing, recruitment/retention, leads and listings...cashflow for buyers
minor cmmtmt: in app purchase,
major cmmtmt: home purchase
capped as af eng, not rewarded for hyperperformance
find right larger brokge/agency... willing to relocate
budget, brokerage/brandbuidling, content is king/gvee, ad network, equity compensation
...quality time, kids/social media/shopping/unpaid labor/gma
what to look for: stale listing, build brand, help pay agent (circle back to stale listing)
problem speedthrough (looking for brokerage/agency fit),
wedding day demo,
backstory (capped potential, recruitment and retention),
problem repeat (prob with small brokerage, sights now on larger brokerage that can accomodate my ambition),
value enhancement: time/quality time, cashflow any property wrt stale listing
brand building
ad network (quality time, fam content creation, fam biz)
cashflow any property
collab/increase demand/stock appreciation
gma quality time/taking advantage of village/unpaid labor
pay agents monthly w/ equity comp w/out having to give away pieces of the brokerage itself
helping
nobody escapes the lessons they need to learn
"""
#demo = gr.Blocks(css="""#btn {color: red} .abc {font-family: "Comic Sans MS", "Comic Sans", cursive !important}""")
with gr.Blocks(theme=gr.themes.Monochrome(), js=js_func) as demo:
ads = gr.Label('EndlessIdeas: Helping Your Ideas Find A Home', label='Sponsors')
with gr.Tab('Update Property Data'):
with gr.Row():
with gr.Column():
upload = gr.Image(label='Upload Room Photo')
upload_photo = gr.Button('Submit Photo')
with gr.Column():
working_room = gr.Gallery(label='Select Working Room')
with gr.Tab('Room Type'):
with gr.Row():
with gr.Column():
working_room2 = gr.Image(label='Working Room')
with gr.Column():
rooms_gallery = gr.Gallery([(v,k) for k,v in bedrooms.items()], label="Room Type")
with gr.Tab('Design Style'):
with gr.Row():
with gr.Column():
working_room3 = gr.Image(label='Working Room')
with gr.Column():
design_gallery = gr.Gallery(label="Design Styles", preview=True)
price_radio = gr.Radio(['Affordable', 'Upmarket'], label='Price Point', interactive=True, visible=True, value='Affordable')
bedsize_radio = gr.Radio(['Full', 'Queen', 'King'], value='Queen', label='Bed Size', interactive=True, visible=False)
with gr.Tab('Color Palette'):
with gr.Row():
with gr.Column():
working_room1 = gr.Image(label='Working Room')
with gr.Column():
color_Palettes = gr.Gallery(label='Proposed Color Palettes')
with gr.Tab('Room Items'):
with gr.Row():
room_items = gr.Gallery(label='Room Items')
with gr.Tab('Item Replace'):
with gr.Row():
with gr.Column():
working_Palette = gr.Image(label='Working Color Palette')
with gr.Column():
esdsd = gr.Gallery(label='Proposed Color Palettes')
with gr.Tab('Shopping Cart'):
pass
"""
control panel: (on item click) include, exclude, replace; full view, shopping cart, upload image, select room, select room type, select colors, select style
side panel: upload image, room type, colors, style,
includfe, exc, attr change/style/Palette; save style-items per img, summ
Staje2Taste: Quick as a click. As simple as shopping.
Don't stress it. Just Staje it.
LVMH and Tesla
Beauty meets speed. The taste of an artist. The efficiency of an engineer.
Outfit your room with the taste of an artist and the efficiency of an engineer wrt to both time and money.
Staje/ the preferred currency of real estate. Staje for real estate, the dollar for everything else.
Like magic, Staje it...turn any property into a cashflowing property with something better than cash. Staje: the preferred currency of real estate. It's Staje for real estate, Bitcoin for the black market, and the dollar for everything else.
100s of millions in rnd
first mover advantage
century 21 supply remax agents
afro unicorn: https://www.youtube.com/watch?v=FkVQtIHjLHI
stealth wealth: https://www.youtube.com/shorts/2EBXkV5vvB4
ai slow: https://www.youtube.com/watch?v=SN2YqBmNijU
rollo: https://www.youtube.com/watch?v=0PeFAzedLnw
katt: https://www.youtube.com/shorts/y2JY92ZtX6Y
sttylone daughter: https://www.youtube.com/shorts/AA7o1K7kLuw
musk billy: https://www.youtube.com/shorts/qCppLqh3QO0
something: https://www.youtube.com/watch?v=L0gSdk-foJk
hu cul: https://www.youtube.com/watch?v=zyXCasIJIDM
do evrything: https://www.youtube.com/watch?v=-AdXIC44b7Q
operating as a man or masquarading as a man
10x falcon: https://www.youtube.com/watch?v=X9_5RKYaKb0
car spy: https://www.youtube.com/watch?v=aoiYa0G_SpA
nba cross: https://www.youtube.com/watch?v=7jzWqJeiW-A
texans: https://www.youtube.com/watch?v=nhZL2fsLbWE
food apps: https://www.youtube.com/watch?v=aFsfJYWpqII
ng ai: https://www.youtube.com/watch?v=wM5837pVh1g
ai secrets: https://www.youtube.com/watch?v=1aM1KYvl4Dw
biz advc: https://www.youtube.com/watch?v=VsbbsAQTQIQ
finaus: https://www.youtube.com/watch?v=YpZiTrWGmL4
katt: https://www.youtube.com/watch?v=tqbfj4SeTF8
ftf caitlin clark: https://www.youtube.com/watch?v=4p_lX5Hd15g
condo repair cost: https://www.youtube.com/watch?v=LDV4eFw4tmY
empty units: https://www.youtube.com/watch?v=9xoIWAf-0YM
fake ai: https://www.youtube.com/watch?v=xbf4BGIBENk
consulting: https://www.youtube.com/watch?v=zJCDZLO9fBM
afrcn passp: https://www.youtube.com/watch?v=C16NArhXpmI
i like her: https://www.youtube.com/watch?v=dIe_HaGdJHM
rich pryor bdygrd insights: https://www.youtube.com/watch?v=vbTHwYiqRA8
change room: https://www.youtube.com/watch?v=eu8F66V1xHo
diversify: https://www.youtube.com/watch?v=Q31C8CWPd4Q
false promses ai: https://www.youtube.com/watch?v=20TAkcy3aBY
aging: https://www.youtube.com/watch?v=jWrvXUKJOiA
2-story basement: https://www.youtube.com/watch?v=GLSrr2stCEM
crazy wmn: https://www.youtube.com/watch?v=AweAuUr4cBI
stealth wealth: https://www.youtube.com/watch?v=_INmFnlp-hU
launder: https://www.youtube.com/watch?v=viM_t5kIpGc
broken economy for young: https://www.youtube.com/watch?v=1jdbP30_kNk
buyers agent: https://www.youtube.com/watch?v=d98pCH9EJVU
rational male: https://www.youtube.com/watch?v=KIk35HA8fEo
rent: https://www.youtube.com/watch?v=cwlwrZst7d0
raise money: https://www.youtube.com/watch?v=8WRbIT1cW2o
blk wmn in la: https://www.youtube.com/watch?v=J2rtvqEqh28
lemonade insrnc: https://www.youtube.com/watch?v=gwAM5pVUMrA
florida for rich: https://www.youtube.com/watch?v=Oowegll0AK0
texas lady developer: https://www.youtube.com/watch?v=6g91Pzd6yO8
minority-developed tiny homes: https://www.youtube.com/watch?v=Zu6sFAEAG7A
build 10-units in 1 yr: https://www.youtube.com/watch?v=H0lzesUnVKQ
pat boyle/handbag wars: https://www.youtube.com/watch?v=pOaQ4IZ6y00
jamie dimon: https://www.youtube.com/watch?v=Rg8wnW3Tt14
tax hike: https://www.youtube.com/watch?v=QAmjcgmVAuI
ai bubble: https://www.youtube.com/watch?v=p0NxSk7YMrI
nana: https://www.youtube.com/watch?v=pDLe9g1XFPY
rents high: https://www.youtube.com/watch?v=-uLV_dU-KMs
stock bro/kendrick fan: https://www.youtube.com/watch?v=kimkgepi79Q
ov-over: https://www.youtube.com/watch?v=TsfiqeJ4iUo
ant: https://www.youtube.com/watch?v=6Oc0DmIqiVc
sm aint real: https://www.youtube.com/watch?v=5oMDs72nLzg
high val man pyrmd: https://www.youtube.com/watch?v=Xs8NhEQLlMc
fantana/drake: https://www.youtube.com/watch?v=GqVjF16HbxE
w/b wmn: https://www.youtube.com/watch?v=Ej74Wpxp4rQ
best joke: https://www.youtube.com/watch?v=YYjkd9UNNm0
each item:
load link
search html
"first", "we started", "next", "next up", "finally", "lastly"..."be mindful", "consider", "take note" tailored individual script from template script
put scripts together for collective script
script view:
convictions/potential/purpose/passion -> convicted/wasting potential
finding right puzzle piece, brokerage/agency fit
singular solution for multiple problems
-subsidized agent commissions (ad partners cover commission->exchange for present/future ad space )
-personalized, purchasable staging (personalized, purchasable, sharable/social...interactable-future,superimposed-experimental) grid pics, bg rmvl
-clear agent value prop for consumer (cashflow prop, )
-intent to buy/sell
-agents ownership w/out giving away shares of the brokerage
-cashflow any property
-future-proof wealth preservation: network is your networth, sells cures all
-recruitment/retention
-leads/listings
https://www.investopedia.com/terms/e/equity-compensation.asp#:~:text=What%20Is%20Equity%20Compensation%3F,firm%20for%20a%20company%27s%20employees.
**capped potential as EE
**respect would be agents/entrepreneurs/business artists
**respect audience/consumer/employee
**utility...purchasable
*value add
-personalized staging
*recruitment/retention
-equity comp
-ad space
-digital real estate/screen space
*user created content for would-be creators (need to have) and agents (nice to have)
-content creation/brand affinity
-dream jobs (intent to sell/buy)
-dream home
-consumer education
-branding
*clear value prop (buyer resistive/reluctant, sell on prop) that resonates w consumer -- how does this make my existence easier/better...the more you explain the weaker you appear
-cashflow
-leads/listings
-subsidized commish (VA buyer)
-"They all got that I'm better than you attitude and you don't understand the industry look" "Why are real estate agents even necessary? They literally dont do anything.": https://www.youtube.com/watch?v=Ky0EB24KKy8
-network as networth
-others/fam as content creators
-quality time
-gma/village
-kids care for parents
-stage any room in any capacity: renters/home owners/prospective home owners
***meta-theme: quality time
***about to happen
outline:
1. intro/backstory/
2. staging value add/quality time...prob: staging not personalized
3. equity comp...RE value add abbrv
4. subsidized commish/brand affinity/ad space/digital real estate/screen space/...consumer value add abbrv
5. future of wealth preservation/ad space non-cash pay...RE value add complete
6. increase property value...consumer value add complete/Big Idea
7. outro: subsdzd commish/cashflow any prop/equity comp/quality time/kid/hero/energy in room/privileged existence/boring-loborious/limited time money/sales people/paranoid/respect limited time they will never get back
**user retention--dream home/job features to encourage frequent usage...paid usage...frequent usage -> app ad space to supplement/replace ad network
**clear, concise value prop: CAN focus on process (navigating offers, inspections, showings) but brevity is best, resonance is a must...focus on wedding, joy of wedding day...cashflow
**we/us verbiage...people like us do things like this
**content-creation-ready
**parallel: paid to make content...paid for use-created content
**combonitorics...limitless content
**state branded apps
**seller concesion
"/watch?v="
econ state vid: https://www.youtube.com/watch?v=S0hh1_WkSJI
https://www.summarize.tech/www.youtube.com/watch?v=S6GHq7OhFY8
**wedding day
**agent centric: unfair advtg
**recruitment/retention
**leads and listings
**superbowl
**feel like falling, natural and accidental: relevant but unrelated
**tl;dw: singular technological solution for multiple real estate related problems
**what's done: personalized staging with purchasable decor/endless, infinite, effortless content (infotainment), combinotrics
**what's next: subsidized commissions, cashflow, and equity compensation for agents, improved staging/visualization, state apps, bed rugs, seller concessions
**what now: best fit
**artist
**public/agent messaging and ads
*Title: Increasing Agent Recruitment and Retention
*TL;DW: Helping Our Agents Sell the Joy of the Buyer's Wedding Day (Closing Day), not the dread of the long Term Cmmtmt.
*Theme: Agent Recruitment and Retention
*Problem: agent-related problem (devalued by consumer...cheated and cheapened) for which we express respect and understanding
***whats done:
-paranoia/digital solution/agent unfair advtg
-personalized staging with purchasable decor -- users: from prospective home buyers and renters, newly decorating or renovating...dream home, dream room, dream decor...budget...utility
-public/agent messaging/branding/marketing/advertising
-brand affinity
-endless, effortless content (infotainment)
-combinotorics
-built for speed, quick and easy, relevant content, improve ntrfce/user exprnce, looking at foundation, design principle: keep it simple, make it pretty
***whats next:
-equity compensation for agents
-recruitment/retention
-ad space/equity comp package
-ad space/digital real estate
-gvee...all in media biz
-client ads
-leads/listings
-partially/fully subsidized commissions
-cashflow
-seller concessions
**don't hope. here, expect the best.
**generational wealth
**network is networth
**shift selling from the price-conscious (fha loans, va loans) to the value aware:
**set the price then sell to the people who do not care about price--only the exchange of value.
**help me understand if im off course as a prospective agent, in my attempt to have myself and my future fellow agents over-deliver and provide value.
**help if im off course: want to transform their time into quality time, helping discover so much more value with the time they give us than they otherwise would with anyone else. We help them to discover so much value with their time that they _want_/prefer to give more of their time to us...working with us is a no-brainer. So what i need your help with is to let me no if im off course in my attempt to create value for the prospective client and subsequently myself and my fellow agents.
**less time communicating/demonstrating value prop...demonstration > explanation!!!
#ease or status, faster or cheaper
*****time savings: comm value prop, expedite decor/moving in prop, content creation(ease)
*****quality time: purchasable decor, fam with content crea, kids care for parents, gma labor of love
**infotainment: inform consumer of tool and its use
***value prop
**in addition to platform (yutube) comp, our partners given ad comp
**agents are incentivized to bring other productive agents into the company
**operationalize tech for third-party use/home buyer...only good now for internal use
**speak to comptish...21 cent/remax
**plan/follow along
**similar home search (in network...get home deets bedrooms bafs zip etc)...searching/decorating remax home, recommended 21st century home
**ad space for businesses->small business->individuals
**future proofing: network over ai or other possible replacement...travel agent
**agent-centric, technology-driven
**convicted: quality time, gma, kids care for prnts
**user-created content
**cashflow any prop...non-cash paym
**stale property
**evergreen problem/solution: furnishing a space
**as quick as a click, as simple as shopping
**respect and understanding
**improve image...of our re agents...messaging...front of mind
**goal is they buy a tremendous amount of value at a discount
*cheated or cheapened
**call to action
**random selections so user not intimidated
**ease of wealth building/preservation
*sales cures all
*access to network
*wholesale adspace, stock up on adspace
**daily user activity: pinterest, with a RE specialization (dream home journey) digital real estate/screen space
*new agents not old...they got it good wink wink dont need to change
*spirit of humility: this is what i've tried, this happened, then i tried this, this is what went wrong, i think this is why it went wrong but i could be missing something...could you help me?
**advtze in a wau thay is more sophisticated, subtle and understated...for the agents that do not want to 'promote' ina way that feels spammy
**add paint as item to buy
**Value = good/bad = payoff/pay up = (dream*likelihood of achievement) / (time rqrd*sacrifice*effort)
VALUE ADD:
scarcity
urgency
gaurantees
bonuses
naming
https://agentslaunch.com/replace-real-estate-agents/
pretty girl: https://www.youtube.com/watch?v=bm4_2rv5zms
snl: https://www.youtube.com/watch?v=sHXAtEY2Nzc
Quinton Miller: Love Yourself, Progress, 2 Late, Mentions, Destiny, Eclipse & Hot N' Cold, show me
she pretty and silly: https://www.youtube.com/watch?v=X6V5TUhTbk8
tech lead: https://www.youtube.com/watch?v=ycfPF1gkNpE
hey, some people dont mind being poor
they romanticize being poor
my time, expensive
my taste, exquisite
my women, exclusive
i want it, i get it
popular loner
*****time savings: comm value prop, expedite decor/moving in prop, content creation(ease)
*****quality time: purchasable decor, fam with content crea, kids care for parents, gma labor of love
--establish tool, intro equity comp for agent, equity comp for buyer, subsidized commish, access to network
--for the overachievers, specifically those who do more than is asked of them simply because they do not want anyone -- including themselves -- to feel cheapened or cheated.
--mark: faster/cheaper/status/ease, need help,
--utilise unskilled: easy content creations
--content sources/citations for quality assurance
kenny: https://www.youtube.com/watch?v=6axGe7OnFlQ
mw: https://www.youtube.com/watch?v=WCRE8C1XXxs
clint coons: https://www.youtube.com/watch?v=nHDP1JYtjrA
-placeholder: agent marketing/messaging vehicle (container)
-replacement: agent value prop (content)
-selling impediments: buyer commission/price-value discrepency
-leaning into infotainment to provide ever more value to the consumer
-b2b: subsidized commission/value add: wholesale ad space pricing
-increase sales volume: prefered listing agent/agency/brokerage
-Asking VA buyers to FINANCE a buyer’s agent fees in their loan? No way; that is insanity! All interest is front loaded and you are paying interest on an agent’s fees? Ridiculous
-we can make network is our networth work for even a smaller franchise of, say, 30,000 agents
-cost cut: buyer/seller commission diversion to value buyers
-forced into convo about price, cuz you do not have a truly differintiated offer than them over there
-ideal scenario: we raise prices, sell only to those who do not care about price just the exchange of value
-price is what you pay, value is what you get...result oriented
-more important: paying the least or getting the best result
-general value prop: cashflow property, subsidized commish...we communicate value faster than them over there, the others
-specific results-oriented value prop: cant have this convo until you talk to prospect
-content creators paid for ads
-cashflow any property...profit generation for any property
-affiliates, homes best product to sell
-superbowl
-youre going to die...act like it, take care of kids
-creative way to showcase prop
is it me, is it you, is it us
is it lust, is it love
is at all of the above
shia: https://www.youtube.com/watch?v=8QHXR8d6_84
austin: https://www.youtube.com/watch?v=_PdkLvrCmWM
princess: https://www.youtube.com/watch?v=rwCVbuDCPt0
condo: https://www.youtube.com/watch?v=jAqCfvRCXgQ
mw: https://www.youtube.com/watch?v=3ZZE4xTWD-s
marriage/psych: https://www.youtube.com/watch?v=Ru3MD9so4dM
mozi: https://www.youtube.com/watch?v=H_ZLs1-jOKQ
https://www.forbes.com/sites/curtsteinhorst/2024/02/06/lost-in-the-scroll-the-hidden-impact-of-the-attention-economy/?sh=29dc92ff6350
In an era where the term "attention economy" is as pervasive as the digital devices that glue us to our screens, every scroll, click, like, and share is more than a mere action; it's a transaction in the world's most valuable currency: our attention.
https://www.business.com/articles/equity-as-compensation/Employers will likely find that those who accept equity compensation work harder, motivated by the understanding that their earnings are linked to the company's performance. Equity compensation serves as an enticing offer for new hires, making it an effective tool for recruitment.
nar: https://www.youtube.com/watch?v=S1v0HaU9QMA
condos: https://www.youtube.com/watch?v=l_8lpBlTUH8
died: https://www.youtube.com/watch?v=cgpoi6MFSXM
tech lead; https://www.youtube.com/watch?v=rJJBnmDkEwI
bw: https://www.youtube.com/watch?v=Gwsw1iKzf9I
steve: https://www.youtube.com/watch?v=gXODOpwzU90
princess: https://www.youtube.com/watch?v=318RetXtT9w
mastering ai for realtors: https://www.youtube.com/watch?v=fURJotcXzNI
work together
work smarter
work harder
in that order
tl; dw: we struggle with following our passion, finding our purpose, and fulfilling our potential...as we have lost touch with our true nature.
-easy content creation that takes little time
-take very common video format of shopping hauls for fashion and adapt to shopping hauls for real estate
-currencies, stores of value,
-currencies: cash, time, attention (attention economy)
-store of value: gold, art, bitcoin
-license software to competitors
-nice to have: agent network, referals as re best product to sale
-industry standard for cashflowing property
-most valuable currencies: time and attention; cost cutting
-taking advantage of the village
*agent can set price, sell to those who do not care about the price just the exchange of value
major job complete (0 to 1)...now, incremental improvements
equity to operate like the wealthy: buy, borrow, die
asset as collateral, borrow against: help in bad economy
not working for money, having money work for them (agents)
inputs/process/outputs/feedback/environment
Value = good/bad = (dream*likelihood of achievement) / (time rqrd*sacrifice*effort)
dream: (what) increased recruitment/retention; (how) diversify agents’ investment portfolios with non-cash pay/equity comp/ownership (network is networth)
likelihood of achievement: precedent, companies paying employees and executives with equity
time rqrd: internal tool ready now, major work done
sacrifice: dont have to give up piece of brokerage/franchise, dedicated entity for equity comp
effort: ive done the 0 to 1 for developing high utility tool for prospective home buyer
VALUE ADD:
scarcity: art/store of value/network effects...perceived as the first/one and only/the original non copycat version
urgency: first mover advantage/brand affinity/cultural cache/google/bitcoin
gaurantees: equity compensation
bonuses: non-cash pay as ad space; can exchange for dollars; increase purchasing power of home buyer, cashflowing property with ad dollars/credits that can be exchanged for cash; referals for ad credits
naming: google 2.0/google group search: collaborative/combinotorial/cohesive and coherent search engine coco
google
amazon: books only to everything
gamify: document the journey, rewarded with ad credits
REAL: making dreams realities (dream property, dream, car, dream job, dream vacation)
search similar property
kenny: https://www.youtube.com/watch?v=AKTMmRdQXr4
product summary: 0 to 1 completed; from newly decorating to renovating, from helping the prospective home buyer visualize themselves in our listing to a renter outfitting their apartment, ...; help facilitate and expedite outfitting a space with purchasable decor; ease and speed, scouring web; cost control with budget-aware feature; address and phone number where applicable; help agent sell wedding day; combinotorics; endless and effortless content creation, infotainment to creatively showcase property; easy enuf for kids/fam to help; quick as a click, as simple as shopping; take very common video concept of shopping hauls for fashion and adapt to shopping hauls for real estate, agent messaging
gvee/compass/post 7 times a day to sm: https://www.youtube.com/watch?v=8io3jzzVHg4
27:40 talk about more than just listing
37:50 market share for RE agents shifting based on being good at sm
gvee suggests creating podcast and cutting up to create 7 pieces of content: we have easier/quicker solution
sell them to themselves -- the better and higher version of themselves: speak to how we can help them to live their ideals and principles, how to easily live out their values.
need to have: non cash pay for agents; dream journeys/user created content/platform
nice to have: cashflow any property;license to other brokerages and franchises;network effects
VP to VLP: value proposition to value-loaded/laden proposition/offer...considerations...care, concern, consideration
future proof for kids: ai unsure future
how will the lack of authenticity translate to their brand?
considerations, cohesion/cohesive value prop: gma and fam
recap: our agents receive equity in cohesive search tech, revolutionize industry by increasing value by cashflowing any property via noncash pay (equity/ad credits), our agents access the future of wealth accumalation and preservation/attention as currency/sales cures all/your network is your networth
*reward assistants with non cash pay
*content: subtly showcase property; quick script; video included
-synthesia for improved video: https://www.youtube.com/watch?v=gZaBwdru_bk
_access_ to network: things money cant buy
separate vehicle, independent of brokerage/franchise brand
-'entreprenuers thrive'-- w limited ownership?
delay your development...to your detriment
to be honest, i think it's nonsense
focus on you and the few: most lose, only a few win
stop trying to save everybody, most people don't want to be saved anyway
problems/parallels
not hoping for the best, expecting the best
use local dataset in hf app: https://discuss.huggingface.co/t/how-to-load-a-huggingface-dataset-from-local-path/53076/3
https://huggingface.co/docs/datasets/en/loading
long beach, orange county, fullerton: cashflow/appreciation
cooly: https://www.youtube.com/watch?v=DXzpMBQZpxQ
saudi: https://www.youtube.com/watch?v=_9mhmFG_qjc
cga: https://www.youtube.com/watch?v=Fzpif1ObrZA
https://huggingface.co/datasets/bigghuggs/test/blob/main/affordable_armchairs_art_deco_brown_light.json
maye: https://www.youtube.com/watch?v=Q7mPpBE-UDs
respect https://www.youtube.com/watch?v=uRcS-E29Icg
ftf: https://www.youtube.com/watch?v=kyx2XvfrkdY
wind en: https://www.youtube.com/watch?v=LklUVkMPl8g
oldr wmn yngr: https://www.youtube.com/watch?v=fdBDYp187T0
yng berg: https://www.youtube.com/watch?v=kC7t_clY5mM
content: recruitment/retention/value prop
wording: time, status, ease, cost cut
voice/tone/style: humble in need of help
flow: convictions (agent retention/value prop start...done/happened) -> convicted (agent pay/value prop new/quick and easy to understand/resonate w consumer...about to do/happen)
convictions: problem statements (show understanding)/agent ownership
problem: agent monthly income/compensation
problem: agent ownership
problem: no unique value proposition: same for agents of other brokerages
problem: cost of commission (buyer/seller)
problem: agent ownership w/out giving away pieces of the brokerage or franchise
parallel: air force hinderance
**help me understand if im off course as a prospective agent, in my attempt to have myself and my future fellow agents over-deliver and provide value.
*Title: Increasing Agent Recruitment and Retention
*TL;DW: (brief summary, to respect your time) Help my fellow agents quickly and succinctly communicate their value proposition; provide an easier way to increase the recruitment and retention of highly productive agents.
*Theme: Agent Recruitment and Retention
*single high-utility technical solution, for myriad real-estate related problems
*Problem: status questioned/image repair needed...agent-related problem (devalued by consumer...cheated and cheapened) for which we express respect and understanding...seen as travel agent, should be able to book on trip--buy/sell own home, lead to agents leaving, agents wanted for network...cheapened or cheatened
what's done:
-paranoia/digital solution/agent unfair advtg
-personalized staging with purchasable decor -- users: from prospective home buyers and renters, newly decorating or renovating...dream home, dream room, dream decor...budget...utility
-public/agent messaging/branding/marketing/advertising
-brand affinity
-endless, effortless content (infotainment)
-combinotorics
-built for speed, quick and easy, relevant content, improve ntrfce/user exprnce, looking at foundation, design principle: keep it simple, make it pretty
***whats next:
-equity compensation for agents
-recruitment/retention
-ad space/equity comp package
-ad space/digital real estate
-gvee...all in media biz
-client ads
-leads/listings
-partially/fully subsidized commissions
-cashflow
-seller concessions
cheap gvt seized property: https://www.youtube.com/watch?v=Yl-lzW_Te6E
-rockeffeler: https://www.youtube.com/watch?v=MTpAY1LKfek
-orion: https://www.youtube.com/watch?v=3JpJ8MG25rs
-seethru: https://www.youtube.com/watch?v=ZfvmdX631Gc
-family office: https://www.youtube.com/watch?v=zaEn3-owb6I
fannie: https://www.youtube.com/watch?v=_iOc6_AXGms
poly: https://www.youtube.com/watch?v=uRwk_n9eqD0
fit: https://www.youtube.com/watch?v=gh2AYgsSWng
re: https://www.youtube.com/watch?v=SgAGWT_6szg
approach: https://www.youtube.com/watch?v=BujD_joQ_hI
godin: https://www.youtube.com/watch?v=zglDZqfHPo4
date: https://www.youtube.com/watch?v=TZ3oVwoTj1U
drake: https://www.youtube.com/watch?v=dHZa5ruO03E
cali oceanfront 11 acres: https://www.zillow.com/homedetails/4400-Via-Abrigada-Santa-Barbara-CA-93110/15904717_zpid/
laguna beach hillside: https://www.zillow.com/homedetails/818-Hillcrest-Dr-Laguna-Beach-CA-92651/25140795_zpid/?mmlb=g,4
billy carson: https://www.youtube.com/watch?v=livgMzeO-ZY
bw and nerds: https://www.youtube.com/watch?v=NiFnOck7S9E
dont approach: https://www.youtube.com/watch?v=ZbC5NU6zg8Y
drake: https://www.youtube.com/watch?v=xxyY_R-9NgU
solo: https://www.youtube.com/shorts/n049gxgFWss
wmn: https://www.youtube.com/watch?v=SoHEU-8-FFU
cute mvng: https://www.youtube.com/watch?v=U0xT_f7uLsQ
jim rhone: https://www.youtube.com/watch?v=mgdIqZrJlvk
poly: https://www.youtube.com/watch?v=zduT_VSPSWo
not ya kids: https://www.youtube.com/watch?v=Gb5P1s6zDFY
drake kenny comedy: https://www.youtube.com/watch?v=K3uWj2MpydI
lady og: https://www.youtube.com/watch?v=9ksrxEiMnuM
messi real estate: https://www.youtube.com/watch?v=tavUdS4Qpb0
wind tunnel: https://www.youtube.com/watch?v=MfAcMJbflCY
ryan leslie: https://www.youtube.com/watch?v=RMVnRJt1N4Q
antarctica : https://www.youtube.com/watch?v=j7tAGqrNq7A
hormozi: https://www.youtube.com/watch?v=h6y0nYVZgwE
caitlin clrk: https://www.youtube.com/shorts/Znhv3gtb0kI
aint no guest rooms we got guest houses
https://www.summarize.tech/www.youtube.com/watch?v=e_-HEkwtLGM
**owned media
https://www.youtube.com/watch?v=Uk7k0iN6ihQ
part of the process, not part of the plan
transcendence/i hit the studio with God in attendence/God as my witness/i kill'ese MCs with ease/it sound like im poppin a tendon/lined em up/t'd em up/now im crossing the finish/im far from my finish/far from completion/im starting to
---
1. intro/backstory/agency search: prospective agent, search best agency-brokerage fit, fit can accomodate idea of uncapped potential, civilian eng, capped, move to entrpnr/re, paranoid, easy to sell in sellers market, need to know how to sell when stale, uncapped re, uncapped consumer
2. staging: personalized, purchasable, use-cases (buyer, renter), dream content, ad space
3. equity comp: recrt/rtention, noncash pay, no brokerage shares, regional app,
4. subsidized commish/va buyers/brand affinity/ad space/digital real estate/screen space/...consumer value add abbrv
5. future of wealth preservation: /ad space non-cash pay...RE value add complete
6. increase property value...consumer value add complete/Big Idea
7. outro: subsdzd commish/cashflow any prop/equity comp/quality time
---
(intro...staging...paranoid survive)
*backstory (civilian/capped)
*entreprenuer/no ceiling/not capped
*find agency/brokerage fit
*consumer view of RE pros
*respect RE pro and consumer/value add
*get value from little time...want to give more time
*stage/purchasable
(RE value add)
*would-be content creators
*quality time with fam...social/fashionova
*equity comp
(Consumer Value Add)
*subsidized commish
*cashflow any prop
*cheated or cheapened
*spirit of humility: this is what i've tried, this happened, then i tried this, this is what went wrong, i think this is why it went wrong but i could be missing something...could you help me?
*staging, cashflow, agent compensation/ownership
*immediate annuity
https://storsquare.com/pods
https://www.youtube.com/watch?v=kn-24_0a-F4
multifam: https://www.youtube.com/watch?v=psFbL8k2xtw
cop: https://www.youtube.com/watch?v=tqBPVB-MSl0
henry: https://www.youtube.com/watch?v=QuCtBwwIHX8
bw effect: https://www.youtube.com/shorts/KfJKL3uhzq0
clark: https://www.youtube.com/shorts/koZYu15jNB8
ai: https://www.youtube.com/watch?v=qruo4yIeWoI
no tax: https://www.youtube.com/watch?v=1eukzvgBAG4
thoward; https://www.youtube.com/watch?v=8xAYf7tYrNk
reading rong: https://www.youtube.com/watch?v=DpIrzA2ohcg
spotify: https://www.youtube.com/watch?v=yDWgOwb8kj4
amrcn drm: https://www.youtube.com/watch?v=IiIrnfro3ic
fnf: https://www.youtube.com/watch?v=xR_G4UOvHaI
"""
#, delete_cache=300
with gr.Blocks(theme=gr.themes.Monochrome(), js=js_func) as demo:
#ads = gr.Image("C:\\Users\\Wayne\\Downloads\\Welcome Home.gif", show_label=False, scale=5, height=150, show_download_button=False)
ads = gr.Label("Dream Home: As Quick As A Click. As Simple As Shopping. ", show_label=False)
seshid = gr.Textbox('SESHID', visible=False)
replace = gr.Gallery(label='Replacement Items', rows=2, columns=7, visible=False)
with gr.Row(visible=False) as store_summary:
merchant_top = gr.Label(label='Merchant')
total = gr.Label(label='Number of Items')
num_of_items = gr.Label(label='Total')
with gr.Row():
with gr.Column(scale=5) as items_display:
room_items = gr.Gallery([((sesh.Palette_img if item == 'Palette' else sesh.default_img ) if item in ['Palette', 'Living Room', 'Bedroom'] else room_item_placeholder_images_dict['LIVING ROOM FURNITURE'][item], item) for item in living_layout_new], label='Room Items', columns=5, height=400)
with gr.Column(scale=1, visible=False) as style_side:
#dsdf = gr.Image("C:\\Users\\Wayne\\Downloads\\agent-first.gif", show_label=False, show_download_button=False)
close1 = gr.Button('Close')
with gr.Column(scale=1, visible=False) as item_side:
merchant = gr.Label('No Item Selected', label='Merchant')
replace_item = gr.Button('Replace')
#sdsd = gr.Image("C:\\Users\\Wayne\\Downloads\\agent-first.gif", show_label=False, show_download_button=False)
close2 = gr.Button('Close')
#with gr.Group():
#with gr.Row():
#exclude = gr.Button('Exclude')
#include = gr.Button('Include')
#Palette_ref = gr.Image(show_label=False)
#replace = gr.Gallery(label='Replacement Items', columns=2)
with gr.Column(scale=1, visible=False) as room_side:
close3 = gr.Button('Close')
summary_button = gr.Button('Summarise')
with gr.Group(visible=False) as summary_group:
with gr.Accordion(label='Merchant Summary') as merchant_summary:
complete_summary = gr.Radio(['Complete', 'Merchant', 'Script'], value='Complete', interactive=True, label='Inspection')
store_dropdown = gr.Dropdown(label='Merchants', visible=False)
with gr.Row(equal_height=True) as budget_row:
budget = gr.Textbox(label='Budget', min_width=70)
#budget_button = gr.Button('Update', size='sm')
complete_source_breakdown = gr.Textbox(label='Item Breakdown', interactive=True)
with gr.Accordion(label='Product Summary', open=False, visible=False) as product_summary:
product_dropdown = gr.Dropdown(label='Products')
count = gr.Number(label='Item Count', minimum=0)
source = gr.Markdown(label='Source')
#room_ad = gr.Image("C:\\Users\\Wayne\\Downloads\\list with us.gif", show_label=False, show_download_button=False)
room_ad = gr.Textbox(visible=False)
with gr.Accordion(label='Select Design Style', open=False) as design_accordion:
design_gallery = gr.Gallery(design_images, label="Design Styles", preview=True)
price_radio = gr.Radio(['Affordable', 'Upmarket'], label='Price Point', interactive=True, visible=True, value='Affordable')
bedsize_radio = gr.Radio(['Full', 'Queen', 'King'], value='Queen', label='Bed Size', interactive=True, visible=True)
with gr.Accordion(label='Update Property Data', open=False) as update_accordion:
with gr.Accordion(label='Upload Photo', open=False):
upload = gr.Image(label='Upload Room Photo')
upload_photo = gr.Button('Submit Photo')
with gr.Accordion(label='Select Room', open=False):
choose_room = gr.Gallery(label="Room To Decorate")
with gr.Accordion(label='Select Room Type', open=False):
room2decorate = gr.Image(label='Working Room')
rooms_gallery = gr.Gallery([(v,k) for k,v in bedrooms.items()], label="Room Type")
with gr.Column(scale=1, visible=False) as colors_side:
#close4 = gr.Button('Close')
with gr.Row():
close4 = gr.Button('Close', size='sm')
with gr.Row():
palettes = gr.Button('Palettes', size='sm', min_width=45)
scripts = gr.Button('Scripts', size='sm', min_width=45)
journeys = gr.Button('Journeys', size='sm', min_width=45)
#dsdsd = gr.Image("C:\\Users\\Wayne\\Downloads\\local ad.gif", show_label=False, show_download_button=False)
with gr.Group(visible=True) as palettes_div:
color_Palettes = gr.Gallery(label='Proposed Color Palettes', columns=2)
with gr.Group(visible=False) as script_div:
status_text = gr.Textbox("loading info for color and character\nstand by...\n", show_label=True, interactive=False, lines=3, label='Status')
scripts_drop = gr.Dropdown(label='Scripts', interactive=True)
script_display = gr.Textbox(label='Script', max_lines=7)
script_broker = gr.Textbox(visible=False)
item_links_load = gr.Textbox(visible=False)
item_links_search = gr.Textbox(visible=False)
script_load1 = gr.Textbox(visible=False)
script_load2 = gr.Textbox(visible=False)
script_load3 = gr.Textbox(visible=False)
script_load4 = gr.Textbox(visible=False)
script_load5 = gr.Textbox(visible=False)
script_load6 = gr.Textbox(visible=False)
script_load7 = gr.Textbox(visible=False)
script_load8 = gr.Textbox(visible=False)
script_load9 = gr.Textbox(visible=False)
script_load10 = gr.Textbox(visible=False)
script_load11 = gr.Textbox(visible=False)
script_load12 = gr.Textbox(visible=False)
script_load13 = gr.Textbox(visible=False)
yt_load = gr.Textbox(visible=False)
linkedin_load = gr.Textbox(visible=False)
facebook_load = gr.Textbox(visible=False)
ytshorts_load = gr.Textbox(visible=False)
reels_load = gr.Textbox(visible=False)
tiktok_load = gr.Textbox(visible=False)
item_links_load_update = gr.Textbox(visible=False)
item_links_search_update = gr.Textbox(visible=False)
script_load1_update = gr.Textbox(visible=False)
script_load2_update = gr.Textbox(visible=False)
script_load3_update = gr.Textbox(visible=False)
script_load4_update = gr.Textbox(visible=False)
script_load5_update = gr.Textbox(visible=False)
script_load6_update = gr.Textbox(visible=False)
script_load7_update = gr.Textbox(visible=False)
script_load8_update = gr.Textbox(visible=False)
script_load9_update = gr.Textbox(visible=False)
script_load10_update = gr.Textbox(visible=False)
script_load11_update = gr.Textbox(visible=False)
script_load12_update = gr.Textbox(visible=False)
script_load13_update = gr.Textbox(visible=False)
yt_update = gr.Textbox(visible=False)
linkedin_update = gr.Textbox(visible=False)
facebook_update = gr.Textbox(visible=False)
ytshorts_update = gr.Textbox(visible=False)
reels_update = gr.Textbox(visible=False)
tiktok_update = gr.Textbox(visible=False)
dummy = gr.Textbox(visible=False)
with gr.Group(visible=False) as journeys_div:
with gr.Accordion('Dream Job', open=False):
dream_job_title = gr.Textbox(label="Dream Job Title")
dream_job_company = gr.Textbox(label="Dream Job Company")
dream_job_salary = gr.Number(label="Dream Job Salary")
dream_job_skills = gr.Textbox(label="Dream Job Required Skills")
current_skills = gr.Textbox(label="Current Skills")
with gr.Accordion('Dream Home', open=False):
dream_home_location = gr.Textbox(label="Dream Home Location")
dream_home_price = gr.Number(label="Dream Home Price")
dream_home_size = gr.Textbox(label="Dream Home Size")
dream_home_features = gr.Textbox(label="Dream Home Features")
current_savings = gr.Number(label="Current Savings")
# Output components
job_progress_textbox = gr.Textbox(label="Progress Towards Dream Job")
home_progress_textbox = gr.Textbox(label="Progress Towards Dream Home")
palettes.click(showPalettes, None, [palettes_div, script_div, journeys_div])
scripts.click(showScripts, None, [palettes_div, script_div, journeys_div, item_links_load])
journeys.click(showJourneys, None, [palettes_div, script_div, journeys_div])
item_links_load.change(loadColorAndCharacter, item_links_load, [item_links_load_update])
item_links_load_update.change(updateLinksLoadStatus, item_links_load_update, [status_text, item_links_search])
item_links_search.change(searchColorAndCharacter, item_links_search, [item_links_search_update])
item_links_search_update.change(updateLinksSearchStatus, item_links_search_update, [status_text, script_load1])
script_load1.change(prepItem1ForScript, script_load1, [script_load1_update])
script_load1_update.change(updateItem1Status, script_load1_update, [status_text, script_load2])
script_load2.change(prepItem2ForScript, script_load2, [script_load2_update])
script_load2_update.change(updateItem1Status, script_load2_update, [status_text, script_load3])
script_load3.change(prepItem3ForScript, script_load3, [script_load3_update])
script_load3_update.change(updateItem3Status, script_load3_update, [status_text, script_load4])
script_load4.change(prepItem4ForScript, script_load4, [script_load4_update])
script_load4_update.change(updateItem4Status, script_load4_update, [status_text, script_load5])
script_load5.change(prepItem5ForScript, script_load5, [script_load5_update])
script_load5_update.change(updateItem5Status, script_load5_update, [status_text, script_load6])
script_load6.change(prepItem6ForScript, script_load6, [script_load6_update])
script_load6_update.change(updateItem6Status, script_load6_update, [status_text, script_load7])
script_load7.change(prepItem7ForScript, script_load7, [script_load7_update])
script_load7_update.change(updateItem7Status, script_load7_update, [status_text, script_load8])
script_load8.change(prepItem8ForScript, script_load8, [script_load8_update])
script_load8_update.change(updateItem8Status, script_load8_update, [status_text, script_load9])
script_load9.change(prepItem9ForScript, script_load9, [script_load9_update])
script_load9_update.change(updateItem9Status, script_load9_update, [status_text, script_load10])
script_load10.change(prepItem10ForScript, script_load10, [script_load10_update])
script_load10_update.change(updateItem10Status, script_load10_update, [status_text, script_load11])
script_load11.change(prepItem11ForScript, script_load11, [script_load11_update])
script_load11_update.change(updateItem11Status, script_load11_update, [status_text, script_load12])
script_load12.change(prepItem12ForScript, script_load12, [script_load12_update])
script_load12_update.change(updateItem12Status, script_load12_update, [status_text, script_load13])
script_load13.change(prepItem13ForScript, script_load13, [script_load13_update])
script_load13_update.change(updateItem13Status, script_load13_update, [status_text, yt_load])
yt_load.change(prepYTLongFormScript, yt_load, [yt_update])
yt_update.change(updateYTLongFormStatus, yt_update, [status_text, ytshorts_load, scripts_drop])
ytshorts_load.change(prepYTShortFormScript, ytshorts_load, [ytshorts_update])
ytshorts_update.change(updateYTShortFormStatus, ytshorts_update, [status_text, facebook_load, scripts_drop])
facebook_load.change(prepFBScript, facebook_load, [facebook_update])
facebook_update.change(updateFBStatus, facebook_update, [status_text, reels_load, scripts_drop])
reels_load.change(prepIGScript, reels_load, [reels_update])
reels_update.change(updateIGStatus, reels_update, [status_text, tiktok_load, scripts_drop])
tiktok_load.change(prepTikTokScript, tiktok_load, [tiktok_update])
tiktok_update.change(updateTikTokStatus, tiktok_update, [status_text, linkedin_load, scripts_drop])
linkedin_load.change(prepLinkedInScript, linkedin_load, [linkedin_update])
linkedin_update.change(updateLinkedInStatus, linkedin_update, [status_text, scripts_drop])
scripts_drop.select(selectScript, None, script_display)
room_items.select(roomItemClick, seshid, [items_display, item_side, room_side, colors_side, replace, ads, store_summary, seshid])
close1.click(closeSidePanel, None, [items_display, item_side, room_side, colors_side, merchant, replace, ads, store_summary])
close2.click(closeSidePanel, None, [items_display, item_side, room_side, colors_side, merchant, replace, ads, store_summary])
close3.click(closeSidePanel, None, [items_display, item_side, room_side, colors_side, merchant, replace, ads, store_summary])
close4.click(closeSidePanel, None, [items_display, item_side, room_side, colors_side, merchant, replace, ads, store_summary])
upload_photo.click(submitPhoto, [upload, choose_room], [choose_room, upload])
#choose_room.select(makePalettes, None, [color_Palettes, room2decorate, room_items])
choose_room.select(makePalettes, seshid, [color_Palettes, room2decorate, room_items])
#upload_photo.click(submitPhoto, upload, [working_room, upload])
#working_room.select(makePalettes, None, [working_room1, color_Palettes])
#working_room.select(makePalettes, None, [working_room1, working_room2, working_room3, color_Palettes, room_items])
working_room.select(makePalettes, seshid, [working_room1, working_room2, working_room3, color_Palettes, room_items])
#rooms_gallery.select(set_style, None, [design_gallery, bedsize_radio, room_items])
rooms_gallery.select(updateRoomType, seshid, [design_gallery, bedsize_radio, room_items])
#color_Palettes.select(set_Palette, None, None)
color_Palettes.select(updateColors, seshid, [room_items])
design_gallery.select(updateStyle, seshid, room_items)
price_radio.select(updatePrice, seshid, room_items)
bedsize_radio.select(updateBedsize, seshid, room_items)
replace.select(productClick, None, merchant)
replace_item.click(replaceProduct, None, [items_display, item_side, room_side, colors_side, merchant, replace, ads, room_items])
#summary_button.click(summarisePerStore, None, None)
summary_button.click(summaryClick, None, [summary_button, design_accordion, update_accordion, room_ad, summary_group, replace, ads, store_summary, store_dropdown, merchant_top, total, num_of_items, complete_source_breakdown])
store_dropdown.select(selectMerchantProduct, None, [product_dropdown, merchant_top, total, num_of_items])
complete_summary.select(changeSummaryFilter, None, [merchant_top, total, num_of_items, product_summary, complete_source_breakdown, budget_row, store_dropdown])
product_dropdown.select(displaySource, None, [source, count])
count.change(updateProductCount, count, [total, num_of_items])
budget.submit(updateBudget, [budget, seshid], [room_items, total, num_of_items])
demo.launch()
#bron: https://www.youtube.com/watch?v=q2XVtWfancQ
#https://www.youtube.com/watch?v=144uOfr4SYA
#boing: https://www.youtube.com/watch?v=y5NTNC7h-Mg
#may: https://www.youtube.com/watch?v=D0duHmPJCP0
#dan: https://www.youtube.com/watch?v=JI3ajrxdLEk
#candace: https://www.youtube.com/watch?v=N3Pmlb8hQ8E
#content crea: https://www.youtube.com/watch?v=wEzrI8MXWJI
#thomas mason: 678-294-9426
#ye intrvw: https://www.youtube.com/watch?v=Z_mk_u24tP0
#vert farms: https://www.youtube.com/watch?v=8BXHu_yXVQk
"""
sharon winsmith vid links
['https://www.summarize.tech/www.youtube.com/watch?v=HNWCqEQHbbw', 'https://www.summarize.tech/www.youtube.com/watch?v=sxDq8cKlZL0', 'https://www.summarize.tech/www.youtube.com/watch?v=wWcLsS-dqbM', 'https://www.summarize.tech/www.youtube.com/watch?v=Vb2nnjU61aA', 'https://www.summarize.tech/www.youtube.com/watch?v=d3ulWjG14F8', 'https://www.summarize.tech/www.youtube.com/watch?v=vWo4W89QC_M', 'https://www.summarize.tech/www.youtube.com/watch?v=s8BHGJpJNbQ', 'https://www.summarize.tech/www.youtube.com/watch?v=JBJTOXRb-1s', 'https://www.summarize.tech/www.youtube.com/watch?v=sey-R2oNMtc', 'https://www.summarize.tech/www.youtube.com/watch?v=DZuHUgs5LZI', 'https://www.summarize.tech/www.youtube.com/watch?v=D1hqio4Ovhw', 'https://www.summarize.tech/www.youtube.com/watch?v=e_-HEkwtLGM', 'https://www.summarize.tech/www.youtube.com/watch?v=WqBH9IM-z_E', 'https://www.summarize.tech/www.youtube.com/watch?v=cUeqAxaXVno', 'https://www.summarize.tech/www.youtube.com/watch?v=aVX20nbMtMc', 'https://www.summarize.tech/www.youtube.com/watch?v=S6GHq7OhFY8', 'https://www.summarize.tech/www.youtube.com/watch?v=DtGDDOG0GNw', 'https://www.summarize.tech/www.youtube.com/watch?v=khcjujeqqYc', 'https://www.summarize.tech/www.youtube.com/watch?v=Ewj_JYbW6ws', 'https://www.summarize.tech/www.youtube.com/watch?v=o7_Bql2MCVY', 'https://www.summarize.tech/www.youtube.com/watch?v=mlYwEnDNsvU', 'https://www.summarize.tech/www.youtube.com/watch?v=mW772GnKaXk',
'https://www.summarize.tech/www.youtube.com/watch?v=kcGJxk6DFfo', 'https://www.summarize.tech/www.youtube.com/watch?v=eg7BJIBojA4', 'https://www.summarize.tech/www.youtube.com/watch?v=o94wCPJUKD4', 'https://www.summarize.tech/www.youtube.com/watch?v=VzQFC7pOHFU', 'https://www.summarize.tech/www.youtube.com/watch?v=0Rjk8vOWMlM', 'https://www.summarize.tech/www.youtube.com/watch?v=R_13GKyQzVM', 'https://www.summarize.tech/www.youtube.com/watch?v=h92m8du0uBU', 'https://www.summarize.tech/www.youtube.com/watch?v=3ZnjNdW3Yck']
['/watch?v=I098YVVPKNg', '/watch?v=1bHMluuJvWQ', '/watch?v=DxMLUORSnX8', '/watch?v=wWcLsS-dqbM', '/watch?v=W9C3dXNj75s', '/watch?v=Vb2nnjU61aA', '/watch?v=WzLsdTMtEQ4', '/watch?v=JBJTOXRb-1s', '/watch?v=sey-R2oNMtc', '/watch?v=DZuHUgs5LZI', '/watch?v=InwE2SHLKr4', '/watch?v=_Fo6XQ5uVBM', '/watch?v=YWKKw6KEVVQ', '/watch?v=vt-w8fQ4azc', '/watch?v=DwWM8vbvDeo', '/watch?v=ZkVPV4E-SpM', '/watch?v=Ewj_JYbW6ws', '/watch?v=OwVNkFlDCRM', '/watch?v=ldzJitnv5WU', '/watch?v=4kAF8oKOfXM', '/watch?v=pqC7TnGTFUk', '/watch?v=pZ0yz_bgZys', '/watch?v=R_13GKyQzVM', '/watch?v=6Z0wMVnKu6c', '/watch?v=4vny4b73Bpo', '/watch?v=DtGDDOG0GNw', '/watch?v=sxDq8cKlZL0', '/watch?v=xzQb0nAbVbI', '/watch?v=d3ulWjG14F8', '/watch?v=s8BHGJpJNbQ', '/watch?v=D1hqio4Ovhw', '/watch?v=v5ty5WkUtNs', '/watch?v=LcQnDMyMzZQ', '/watch?v=m5XB-oLhP_c', '/watch?v=WqBH9IM-z_E', '/watch?v=aVX20nbMtMc', '/watch?v=pxHVryUekas', '/watch?v=r8rC249ejpg', '/watch?v=z_TrpVIT9FA', '/watch?v=xvS9ZbgHvkI', '/watch?v=o94wCPJUKD4', '/watch?v=JfR-q98bzgY', '/watch?v=VzQFC7pOHFU', '/watch?v=hGMAA9bmOaQ', '/watch?v=VCj3Ox-nYdw', '/watch?v=w__YGvMSG0A', '/watch?v=4zKAodLw3wk', '/watch?v=bZsADZ0vOFQ', '/watch?v=INTavo7i7pw', '/watch?v=SvwbpTSsWtA', '/watch?v=nX58nJk538Y', '/watch?v=Dx6VFYCoOCo', '/watch?v=aMBNuu0G5YM', '/watch?v=PM4kVYlt3MM', '/watch?v=R6l6xXJYc3I', '/watch?v=BiiHiCVVorM', '/watch?v=S6GHq7OhFY8', '/watch?v=yFOL71x1kAM', '/watch?v=5u-ljCuJo78', '/watch?v=khcjujeqqYc', '/watch?v=o7_Bql2MCVY', '/watch?v=mlYwEnDNsvU', '/watch?v=Fjv-8fNz9oQ', '/watch?v=5yV770uR-y4', '/watch?v=0Rjk8vOWMlM', '/watch?v=97yl8oIdOn4', '/watch?v=26k2feZfpWs', '/watch?v=ShqgRR_aTlo', '/watch?v=HNWCqEQHbbw', '/watch?v=izhUH2QnKDI', '/watch?v=iURB5PbEUD4', '/watch?v=2xzulpSYjsw', '/watch?v=kIcN1w0Xo8c', '/watch?v=vWo4W89QC_M', '/watch?v=5s0UBwfjNJY', '/watch?v=BZGBHe0JqxM', '/watch?v=wqCFQnU7GFQ', '/watch?v=e_-HEkwtLGM', '/watch?v=KbtSTcNzOvQ', '/watch?v=QNnKcWxBnLs', '/watch?v=cUeqAxaXVno', '/watch?v=K0RxTcxCgWI', '/watch?v=oop0nk2qgRk', '/watch?v=u-m2c8XKYt8', '/watch?v=JPW9lEIWSNU', '/watch?v=mW772GnKaXk', '/watch?v=xxiNuA05NRU', '/watch?v=kcGJxk6DFfo', '/watch?v=ZgP4Mxg_8Hg', '/watch?v=KqEHW5Wcyow', '/watch?v=eg7BJIBojA4', '/watch?v=W5KZo3Uir7s', '/watch?v=K_5aTRb1OZQ', '/watch?v=nMQdD4WIywY', '/watch?v=h92m8du0uBU', '/watch?v=3ZnjNdW3Yck']
turtle: https://www.youtube.com/shorts/zv7U4EWGQKw
ken mcelroy biz lessons: https://www.youtube.com/watch?v=jXq-dy0oOss
"""