Skip to content

4d-depot/DEMO_AI_Vector_ImageSearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEMO_AI_Vector_ImageSearch

Semantic Image Similarity Search with 4D.Vector and 4D AI Kit (4D 20 R10).

This demo illustrates how to:

  • Generate embeddings (vectors) from text prompts and image descriptions.
  • Compare vectors using cosine similarity, dot product, and Euclidean distance.
  • Search images by meaning, not by filenames or metadata.

👉 Full explanation available in the blog post.

Installing and Using a 4D Project

📦 Pre-requisites

4D Software:

OpenAI API Key (required for AI-powered semantic search):

  • Generate one here: OpenAI API Keys
  • Best practices:
    • Never share your key publicly (e.g., in GitHub).
    • Store securely (environment variables, config files outside version control).
    • Monitor usage in the OpenAI dashboard.
    • Set limits or alerts to avoid unexpected costs.

Qodly Studio:

▶️ Steps to Run the Project

  1. Clone or download this repository to your local machine.
  2. Open the project in 4D:
  3. Go to Design > Qodly Studio… > Preview.
  4. Enter your OpenAI API Key:
    • Go to the API Key input field in the Info tab and fill it.
    • If you forget, the demo will prompt you with a modal before proceeding.
  5. Play with the demo:
    • Type or select a prompt → The app compares it with stored vectors and returns ranked images.
    • Upload images → The app generates a caption & description, then embeds them as vectors.
  6. Inspect the code:
    • Switch to design mode: Mode > Return to Design Mode.

Releases

No releases published

Packages

No packages published