Giter Club home page Giter Club logo

showcase-ai-image-search's Introduction

Note

Work in progress ๐Ÿšง

๐Ÿค– AI Image Search, powered by Typesense

This is a demo that showcase Typesense's Image Search feature which includes:

  • Search images using text descriptions of their contents
  • Image Similarity search

Tech Stack

The data contains 1265 best images out of the first 5000 image-prompt pairs which were taken from DiffusionDB and then filtered based on aesthetics using aesthetics-scorer.

Project Structure

โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ data/
โ”‚   โ”‚   โ””โ”€โ”€ 20-images.json
โ”‚   โ””โ”€โ”€ indexTypesense.ts # script that index data from 20-images.json into typesense server
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ app/
    โ”‚   โ”œโ”€โ”€ [slug]/
    โ”‚   โ”‚   โ””โ”€โ”€ page.tsx # explore similar style (search similar images with image)
    โ”‚   โ””โ”€โ”€ page.tsx # search images using text descriptions
    โ”œโ”€โ”€ components/
    โ”‚   โ””โ”€โ”€ UI components...
    โ”œโ”€โ”€ hooks/
    โ”‚   โ””โ”€โ”€ useImageSearch.ts
    โ””โ”€โ”€ lib/
        โ””โ”€โ”€ typesense.ts # typesense client config

Development

To run this project locally, make sure you have docker and nodejs, install dependencies and start the dev server:

Installation

git clone https://github.com/typesense/showcase-ai-image-search.git

cd showcase-ai-image-search

npm i

Start typesense server

npm run start:typesense # or: docker compose up

Download sample data:

# From the root of the repo:

curl -o ./scripts/data/20-images.jsonl https://ai-image-search-images.typesense.org/20-images.jsonl

Index data into typesense

npm run index:typesense

Start the dev server

npm run dev

Open http://localhost:3000 to see the app โœŒ๏ธ

Environment

Set env variables in .env file to point the app to the Typesense Cluster

NEXT_PUBLIC_TYPESENSE_SEARCH_ONLY_API_KEY=xxx
NEXT_PUBLIC_TYPESENSE_HOST=xxx.typesense.net
NEXT_PUBLIC_TYPESENSE_PORT=443
NEXT_PUBLIC_TYPESENSE_PROTOCOL=https
NEXT_PUBLIC_IMAGE_BASE_URL=...

Only for indexing:

DIFFUSION_DB_JSONL_FILE=...
TYPESENSE_ADMIN_API_KEY=...
INDEXING_BATCH_SIZE=100

showcase-ai-image-search's People

Contributors

phihero avatar jasonbosco avatar

Stargazers

 avatar Srivamsi Sakirepalli avatar Maria Laura avatar  avatar

Watchers

 avatar Kishore Nallan avatar  avatar

Forkers

phihero

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.