Skip to content

immanuel-peter/semantic-image-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semantic Image Search Engine

This project leverages PyTorch and OpenAI CLIP for advanced text-based semantic image search capabilities. The backend is built using FastAPI, ensuring a robust and high-performance server, while the frontend is developed with Next.js, providing a seamless and responsive user experience.

Demo

Features

  • Text-based semantic image search using OpenAI CLIP
  • Frontend built with React (Next.js) and styled with Tailwind CSS
  • Backend built with FastAPI and powered by PyTorch
  • Preloaded random images for demonstration purposes

Technologies Used

  • Backend: FastAPI, PyTorch, Hugging Face Transformers
  • Frontend: Next.js, Tailwind CSS, React
  • Other: Node.js, Python, OpenAI CLIP

Prerequisites

Before running the project, make sure you have the following installed:

Installation

Clone the Repo

git clone https://github.com/your-username/your-repo.git
cd your-repo

Backend Setup

  1. Navigate to the backend directory:
    cd backend
  2. Create a virtual environment:
    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  3. Install dependencies:
    pip install -r requirements.txt
  4. Start the FastAPI server:
    uvicorn call:app --reload
    By default, the server will run at http://127.0.0.1:8000.

Frontend Setup

  1. Navigate to the frontend directory:
    cd frontend/semantic-image-search
  2. Install dependencies:
    npm install
  3. Start the development server:
    npm run dev
    The frontend will be available at http://localhost:3000.

Using Different Images

If you’d like to use different images for the project:

  1. Replace the images in the random-images folder:
    • Use the provided script to fetch random images from Unsplash:
      python backend/get-random-images.py
      Note: You need an Unsplash Developer Access Key to use the script. Add it to the script by replacing the placeholder ACCESS_KEY with your access key.
  2. Alternatively, manually replace the images in the random-images folder with your own collection.

Usage

  1. Open the frontend in your browser: http://localhost:3000.
  2. Search for images using text queries such as "beautiful sunset," "expansive ocean," or "snowy mountains."
  3. Results will display a set of images matching the query from the preloaded random dataset.

About

Semantic image search with PyTorch and OpenAI CLIP. Utilizes FastAPI for backend and Nextjs for frontend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published