Skip to content

pushkarydv/memory-in-images

Repository files navigation

Memory in Images

Search within your images using natural language. This application allows you to upload images, automatically analyze them, and later search through them using conversational queries.

Memory in Images

Why this?

The usual image search available has a limitation—you can't search for a specific moment you remember from thousands of images. However, with this approach, it becomes possible to search even for small details. Here are a few examples of queries you can make:

  • Hiking on a mountain with cows on the path
  • When I was fat
  • Visiting a haunted place

Features

  • 🖼️ Upload and store images using Cloudinary
  • 🔍 Search through images using natural language queries
  • 🧠 Vector embeddings for efficient image search
  • 🤖 Powered by Llama 3.2 11B model via Groq
  • 📊 Vector storage via Upstash
  • ⚡ Fast and responsive Next.js frontend

Technology Stack

  • Frontend: Next.js with TailwindCSS
  • Image Storage: Cloudinary
  • AI Models:
    • OpenAI for vector embeddings
    • Llama 3.2 11B via Groq for natural language processing
  • Vector Database: Upstash Vector Database

Deployment

One-Click Deploy

Deploy directly to Vercel with all required environment variables:

Deploy with Vercel

Environment Variables Setup

Cloudinary (Image Storage)

  1. Create a free account at Cloudinary
  2. Navigate to the Dashboard
  3. Copy your Cloud Name, API Key, and API Secret
  4. Create an unsigned upload preset in Settings > Upload > Upload presets
  5. Add these values to your .env.local file:
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your_cloud_name

AI Providers (Both Required)

OpenAI API (for embeddings)

  1. Sign up at OpenAI
  2. Create a new secret key
  3. Add to your .env.local file:
OPENAI_API_KEY=sk-your_openai_api_key

Groq API (for Llama 3.2 11B model)

  1. Sign up at Groq
  2. Generate an API key
  3. Add to your .env.local file:
GROQ_API_KEY=your_groq_api_key

Upstash Vector Database

  1. Sign up at Upstash
  2. Create a new Vector database
  3. Get the REST API URL and Token
  4. Add to your .env.local file:
UPSTASH_URL=your_upstash_url
UPSTASH_TOKEN=your_upstash_token

Additional Settings

Control whether uploads are enabled:

NEXT_PUBLIC_UPLOAD_DISABLED=false

How It Works

  1. Image Upload: Images are uploaded to Cloudinary for storage.
  2. Image Analysis: Each image is analyzed using LLaMA 3.2 Vision, generating descriptive text and vector embeddings via OpenAI.
  3. Vector Storage: Embeddings are stored in the Upstash Vector Database.
  4. Natural Language Search: User queries are converted to vectors using text-embedding-3-small.
  5. Vector Matching: The system finds relevant images based on vector similarity.
  6. Image Display: Matched images are displayed with their similarity scores.

image image

Screenshots

Screenshot 2025-03-03 at 7 01 45 AM Screenshot 2025-03-03 at 7 00 54 AM Screenshot 2025-03-03 at 7 00 24 AM

Local Development

  1. Clone the repository
git clone https://github.com/yourusername/memory-in-images.git
cd memory-in-images
  1. Install dependencies
npm install
# or
yarn install
# or
pnpm install
  1. Create a .env.local file with all the required environment variables

  2. Run the development server

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
  1. Open http://localhost:3000 with your browser to see the result

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues during setup or deployment:

Live Demo

Check out the live demo to see the application in action.


Built with ❤️ by Pushkar Yadav

About

Search within your images using natural language.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors