Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

WORK IN PROGRESS | Text to image search & Image Similarity Search using @Typesense
https://github.com/typesense/showcase-ai-image-search

clip-model clip-vit image-search similarity-search text-to-image-search typesense typesense-showcase vector-search

Last synced: about 2 months ago
JSON representation

WORK IN PROGRESS | Text to image search & Image Similarity Search using @Typesense

Awesome Lists containing this project

README

        


🤖 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

🌇 🔍 Live Demo: [ai-image-search.typesense.org](https://ai-image-search.typesense.org)

## Tech Stack

- Typesense
- NextJS
- Typescript
- Tailwind

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

```bash
├── 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

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

cd showcase-ai-image-search

npm i
```

Start typesense server

```shell
npm run start:typesense # or: docker compose up
```

Download sample data:

```shell
# 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

```shell
npm run index:typesense
```

Start the dev server

```shell
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

```env
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:

```env
DIFFUSION_DB_JSONL_FILE=...
TYPESENSE_ADMIN_API_KEY=...
INDEXING_BATCH_SIZE=100
```