Preparing the Product Catalog
Let's create a new product catalog from scratch. Our made-up E-commerce store sells colorful bags. Start by creating a new folder for the product images and add it to the Jupyter Notebook:
Jupyter Notebook
image_path = "data/bags"
Next, go ahead and find images for your products. Here are the 7 bags we'll use for the walkthrough:
Now, let's go ahead and add the path and a description for each bag:
Jupyter Notebook
image_paths = ["1.png", "2.png", "3.png", "4.png", "5.png", "6.png", "7.png"]
descriptions = ["Red bag", "Brown bag", "Blue bag", "Pink bag", "Mint bag", "Salmon bag", "Black bag"]
The next step is to add all the product data to a Pandas DataFrame:
Jupyter Notebook
# Generate a unique UUID for each product
ids = [str(uuid.uuid4()) for _ in range(len(image_paths))]
# Create a DataFrame with columns for ID, image, and vector
df = pd.DataFrame({'ID': ids, 'image': image_paths, 'description': descriptions})
df
The df
output should look something like this:
Now that we have a DataFrame with our products, let's create embeddings for each bag in the next step.