GenAI in e-commerce: Unveiling its content, multimodal and translation benefits

GenAI in e-commerce: Unveiling its content, multimodal and translation benefits

Avatar von Daniel Hallmann

Generative AI (GenAI) is an innovative tool powered by artificial intelligence technology designed to enhance productivity and streamline operations. It is particularly useful in sectors like e-commerce, where it can swiftly generate product descriptions, images, and other necessary content. Offering speed, accuracy, and efficiency, GenAI significantly reduces the time and resources consumed in manual creation, enabling businesses to allocate more time to their core operations. Although it offers automated solutions, human supervision should remain to ensure the quality of the generated content.

What are the benefits of GenAI?

The use of GenAI for content generation offers multiple benefits. It boosts productivity by automating the creation of various types of content, such as text, images, music, and more. With GenAI, you can create vast amounts of content in less time, which is particularly useful for large projects. It also enables customization, as the AI learns and adapts to specific styles or themes. This allows for personalized content that aligns with your brand or audience’s preferences. Furthermore, GenAI opens up new creative possibilities, such as creating unique, AI-generated artwork or music. Lastly, it helps reduce costs as it minimizes the need to involve multiple content creators.

GenAI is an intense driving factor in optimizing the processes and outcomes in e-commerce and online shops. We want to highlight here its importance, knowing in mind that there exists many more:

  • Time and cost efficiency: GenAI enables businesses to generate high-quality product descriptions automatically, saving substantial time and resources that would otherwise be spent on manual content creation.
  • Consistency and scalability: With GenAI, businesses can ensure consistent and standardized product descriptions across their entire inventory, even with a large number of products. This scalability contributes to a cohesive brand image and improves the overall customer experience.
  • Increased productivity: By automating content generation, businesses can free up their human resources to focus on more strategic tasks, such as marketing, customer engagement, and product development, leading to improved productivity and innovation.

To make these benefits more practical, we now showcase three code examples of how new AI technologies could support speeding up your work. We show how to:

  1. Generate product descriptions based on product images.
  2. Generate new product descriptions based on existing descriptions.
  3. Translate English product descriptions into German versions.

Try it yourself!

We use Python in our examples because of its strong AI support and huge community. While Python has several AI and Machine Learning libraries like TensorFlow, PyTorch, and Keras, for creating GenAI applications, we experienced the current GPT-4 version, which is developed by OpenAI, as best suited to start easily and get quite fast results. Please note that OpenAI charges to use the GPT API.

You can find the source code in our repository, which covers all methods, libraries, and further details.

Generate product descriptions based on product images

We start with the generation of product descriptions directly from images, which can be accomplished by using a combination of Computer Vision (CV) and Natural Language Generation (NLG) steps. Primarily, the two parts combine:

  • Image recognition to identify various properties of the product.
  • Generation of property-based descriptions.

To achieve our task, we use GPT-4-vision for the CV and NLG parts. Here is a very generic and high-level example of how you might generate a description from a red sports shoe image using the vision and content generation part of the model:

import base64
import requests
 
def generate_product_description_on_product_image():
  # Function to encode the image
  def encode_image(image_path):
    with open(image_path, "rb") as image_file:
      return base64.b64encode(image_file.read()).decode('utf-8')
 
  # Path to your image
  image_path = 'your-image-path'
 
  # Getting the base64 string
  base64_image = encode_image(image_path)
 
  headers = {
    "Content-Type": "application/json",
    "Authorization": f"""Bearer 'your-api-key'"""
  }
 
  payload = {
    "model": "gpt-4-vision-preview",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Create a product description for the image."
          },
          {
            "type": "image_url",
            "image_url": {
              "url": f"data:image/jpeg;base64,{base64_image}"
            }
          }
        ]
      }
    ],
    "max_tokens": 300
  }
 
  response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
 
  print(response.json()['choices'][0]['message']['content'].strip())
 
# Introducing the Accelerate V5 Running Shoes – combining performance, comfort, and style in one vibrant package.
#
# These sleek red running shoes are crafted for athletes who demand both speed and stability. The bold color and dynamic design convey a sense of motion even when standing still.
# ...

In the above code, replace ‚your-image-path‘ with the actual image URL and ‚your-api-key‘ with your actual OpenAI API key. This example transforms the product image into a base64 version and posts it as JSON encoded payload to the OpenAI chat completions API. To get the generated description, we only need to decode the JSON response and access the resulting array entry.

Please note that using computer vision to interpret complex product images is a large task in its own right, which is currently being researched in the preview highlights in the model name. In a real-world scenario, please ensure getting meaningful results before providing the descriptions in production.

Generate new product descriptions based on existing descriptions

Our second practical example addresses the frequent task of writing product descriptions based on previously generated descriptions, whether you need a summary to tease your product or an elaborated version in the context of shipping handbooks. Here is a simplified example using the GPT-4 model.

from openai import OpenAI
 
def generate_product_descriptions():  
  client = OpenAI(
      api_key='your-api-key'
  )
 
  response = client.chat.completions.create(
     messages=[
        {
            "role": "user",
            "content": """The product is a wireless Bluetooth earbuds with high definition sound quality, 20 hours of battery life, and a compact charging case.
             
            Describe a similar product:""",
        }
    ],
    model="gpt-4",
    temperature=0.5,
    max_tokens=100,
  )
 
  print(response.choices[0].message.content.strip())
 
  # This product is a cordless Bluetooth earphones featuring superior audio quality, 24 hours of battery duration, and a small-sized charging case.

To generate a description based on existing descriptions, you’ll need to feed an origin description as a prompt to the model. The accuracy and relevance of the generated content would be dependent on these descriptions.

Moreover, it is advised to verify the generated content here before using it directly to ensure that it doesn’t contain anything unwanted or out of context.

Translate English product descriptions into German versions

The last example covers the translation of an English product description to German while using the previous gpt-4 model. Providing product descriptions in different languages is a common task in global environments to expand your business and reach all customers.

from openai import OpenAI  
 
def translate_english_to_german():
  client = OpenAI(
    api_key='your-api-key' # Replace with your OpenAI API key
  )
 
  # Provide some instructions for the model
  instructions = """Translate the following English product description to German:
   
  English: This high-quality camera offers a resolution of 20 megapixels and a 5x optical zoom.
   
  German:"""
   
  # Generate the translation using ChatGPT
  response = client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": instructions,
        }
    ],
    model="gpt-4",
    temperature=0.7,
    max_tokens=100,
  )
 
  german_translation = response.choices[0].message.content.strip()
  print("German translation:", german_translation)
 
# German translation: Diese hochwertige Kamera bietet eine Auflösung von 20 Megapixeln und einen 5-fachen optischen Zoom.

The code defines an instruction string containing the translation task, followed by the original English version, and lastly, closed with the German keyword to instruct GPT to start completing the prompt with the generated translation version. There are many more additional languages available (~90), which provides a broad spectrum reaching customers with your products.

How fast is GenAI content generation compared to manually creating product texts and images?

This section is more for fun but should generally give a sense of how GenAI can produce content faster than manual creation, which could be potentially hundreds of times faster. A task that might take a human minutes, hours, or even days can be accomplished by AI in a matter of seconds or minutes, depending on the complexity and length of the content. It’s important to note that while the speed and efficiency of GenAI is an advantage in generating large volumes of content, it typically requires human oversight for improvements and adjustments for better quality and context-specific requirements.

Producing handwritten text like product descriptions depends highly on the person’s typing speed and knowledge in the domain. On average, a typist can manage approximately 40-60 words per minute. Therefore, typing 300 words would take around 5-7 minutes for an average typist—in case of producing a creative product description, it can take even longer. To provide some numbers of how fast our three code snippets produce content, here are some results that are not bad:

TestGenAI
Product descriptions based on product images (300 words)9 sec
Product descriptions based on existing descriptions (100)4 sec
Translate product descriptions (100)3 sec

Summary and potential future directions for GenAI

GenAI is an artificial intelligence tool that enhances efficiency and productivity for e-commerce. It can quickly generate product descriptions, images, and other content, potentially hundreds of times faster than manual creation. This reduces the time and resources spent on these tasks, allowing businesses to focus more on their core operations. However, while GenAI offers speed and efficiency, it often still requires human oversight to ensure the quality and relevance of the generated content.

We walked through three practical code examples to give a sense of how easily it is to implement the generation of product descriptions on images, new production descriptions of existing ones, and translation into new languages. I hope we gave some insights into the field of GenAI and the potential we all can benefit from in the future. To round up this article, we would like to end with some future trends in GenAI to keep our ideas spinning. Based on current trends, GenAI:

  • Enhances in its multimodal capabilities, it can interact with and understand different forms of data.
  • Offers improved control and consistency in outputs and is becoming more accessible to developers through low code/no code interfaces.
  • Is viewed as a platform for creating marketplaces of GPTs, allowing users to discover new applications and publish their own.
  • Costs have decreased, making it more affordable for enterprise customers.

These are some possibilities to reflect the future developments of GenAI. We look forward to seeing how GenAI continues and what practical benefits it will additionally serve. Stay tuned.

Avatar von Daniel Hallmann

Kommentare

Eine Antwort zu „GenAI in e-commerce: Unveiling its content, multimodal and translation benefits“

  1. […] beliebigen Sprache kommunizieren können. Auch wenn ein Agentenlauf in englischer Sprache abläuft, können Fragen und Antwort in nahezu jede beliebige Sprache übersetzt und ausgegeben […]

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert


Für das Handling unseres Newsletters nutzen wir den Dienst HubSpot. Mehr Informationen, insbesondere auch zu Deinem Widerrufsrecht, kannst Du jederzeit unserer Datenschutzerklärung entnehmen.