This project is an Image Similarity Search Engine built with Python, utilizing Streamlit for the user interface and integrating with AI models via Ollama and CrewAI for advanced image analysis and keyword generation. The application allows users to upload an image, analyze its content, generate relevant search keywords, and find visually similar images online using the SerperAPI. It demonstrates the power of combining local AI models with web APIs to create a seamless user experience for image-based searches, making it easier for users to find what they're looking for without needing to manually craft search queries.
- Python: The primary programming language for the project.
- Streamlit: A Python library for building interactive web applications.
- Ollama: A framework for running local AI models, such as Llava and Qwen, for image analysis and keyword generation.
- CrewAI: A library for creating AI agents to automate tasks, such as generating search keywords.
- SerperAPI: An external API for performing image searches based on generated keywords.
- Langchain: Used for prompt templates and output parsers to structure AI interactions.
To run this project, you need to have Python installed on your machine, along with Ollama for running local AI models. Additionally, you'll need a SerperAPI key for image search functionality.
-
Install Python and necessary libraries:
- Ensure you have Python 3.8 or higher installed.
- Install required libraries using pip:
pip install streamlit requests langchain-core langchain-ollama crewai
- Note: The project uses Langchain for prompt templates and output parsers, but it does not require
langchain-openaisince it uses Ollama locally.
-
Set up Ollama:
- Install Ollama from their official website or using your package manager.
- Download the required models (
llava:13bandqwen2.5) using Ollama:ollama pull llava:13b ollama pull qwen2.5
- Start Ollama if it's not already running:
ollama serve
-
Obtain SerperAPI Key:
- Sign up for a SerperAPI account at SerperAPI and get your API key.
-
Set Environment Variables:
- Set the
SERPER_API_KEYenvironment variable with your API key.- On Linux/Mac:
export SERPER_API_KEY=your_api_key_here - On Windows:
set SERPER_API_KEY=your_api_key_here
- On Linux/Mac:
- Set the
Note: Running AI models locally can be resource-intensive. Ensure your machine has sufficient CPU, GPU, and memory to handle the workload.
-
Clone the repository:
git clone https://github.com/armanjscript/Image-Similarity-Search-Engine.git
-
Navigate to the project directory:
cd Image-Similarity-Search-Engine -
Run the application:
streamlit run main.py
-
Upload an image in the Streamlit interface to see the similar images found online.
- Upload an image and get a detailed description using AI.
- Automatically generate search keywords based on the image content.
- Find and display visually similar images from the web.
- User-friendly interface built with Streamlit.
- Handles errors gracefully, with fallback options for manual keyword input.
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request. If you encounter any issues or have suggestions for improvement, feel free to open an issue or reach out.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or feedback, please contact me at [armannew73@gmail.com].