generated fromrajrajhans/phoenix-elixir-nix-starter
- Notifications
You must be signed in to change notification settings - Fork3
rajrajhans/bumblebee-media-search
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
- A demo application that uses theCLIP model for natural language media search (searching images with text, and searching related images with an image).
- Built usingPhoenix Framework,Bumblebee,Axon,Nx andHNSWLib.
![]() | ![]() |
|---|---|
![]() | ![]() |
![]() | ![]() |
|---|---|
![]() | ![]() |
- This uses Nx Servings for serving the CLIP model. There are two sets of Nx Servings in the codebase:
- Nx Servings provided by Bumblebee for text & image embeddings: Using ready made Nx Servings provided by Bumblebee library.
- Hand rolled Nx Servings for text & image embeddings: Custom implemented Nx Servings intended to learn how to implement Nx Servings from scratch.
- Both provide the same output and can be used interchangeably. However, if you're interested in learning how Nx Serving works and how to implement them, the hand rolled Nx Serving files will be helpful.
- Uses Nix for dependency management.Install Nix if you don't have it already.
- Clone the repository and run
direnv allowto activate the environment. - To install dependencies, execute
run deps. - To start the server, execute
run server.
- Create a directory
priv/imagesand copy all your images to this directory. - Run the function
build_indexto create an index from the images. It will vectorize the images, create index and save it topriv/clip_index.annandpriv/clip_index_filenames.jsonfiles. To run the function, start the server usingrun mix phx.serverand then run the function iniexshell usingMediaSearchDemo.Clip.build_index().
- Download the dataset fromhttps://unsplash.com/data/lite/latest.
- Extract and copy the
photos.tsv000file toprivdirectory. (You can directly download thephotos.tsvfile fromhere without downloading the whole dataset). - Run the script
download_unsplash_dataset.exbyrun elixir priv/scripts/download_unsplash_dataset.exto download the images from the dataset. It will concurrently download images topriv/imagesdirectory. - Once the images are downloaded to
priv/imagesdirectory, you have two options:- Follow the steps inUsing with Your Images section to create an index from the 25k Unsplash images. (will take some time)
- Download the pre-built index files fromhere andhere and save both to
privdirectory.
- The application uses theCLIP model with Bumblebee and Nx to create an index of images and then search the index for related images.
- For more details, please check the talk slides. Slides can be foundhere
About
A demo application that uses the CLIP model for natural language media search (searching images with text, and searching related images with an image).
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.







