|
|
--- |
|
|
title: Image |
|
|
emoji: π |
|
|
colorFrom: red |
|
|
colorTo: red |
|
|
sdk: streamlit |
|
|
sdk_version: 1.42.2 |
|
|
app_file: app.py |
|
|
pinned: false |
|
|
--- |
|
|
|
|
|
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference |
|
|
|
|
|
|
|
|
|
|
|
This documentation provides a detailed overview of the CLIP-based Image & Text Search App using Streamlit as the frontend and Pinecone for vector-based image retrieval. |
|
|
|
|
|
<!-- project overview --> |
|
|
This project enables text-to-image and image-to-image search using OpenAIβs CLIP model. It retrieves similar images from a Pinecone vector database. |
|
|
<!-- features --> |
|
|
Text-to-Image Search β Find images using text descriptions. |
|
|
Image-to-Image Search β Upload an image to find visually similar images. |
|
|
CLIP Model Integration β Uses OpenAI's CLIP (Contrastive Language-Image Pretraining). |
|
|
Pinecone for Vector Search β Stores and retrieves image embeddings efficiently. |
|
|
Streamlit Interface β Provides an interactive UI. |
|
|
|
|
|
<!-- installation and dependencies --> |
|
|
1. Ensure you have installed python installed |
|
|
pip install -r requirements.txt |
|
|
|
|
|
2. start run the streamlit |
|
|
streamlit run app.py |
|
|
|
|
|
<!-- Application workflow --> |
|
|
1. Load CLIP Model & Processor β Initializes the CLIP model for text and image embeddings. |
|
|
2. Generate Embeddings β Converts input text/images into 768-dimensional feature vectors. |
|
|
3. Query Pinecone Database β Searches the Pinecone index for similar image embeddings. |
|
|
4. Display Results β Shows matching images with similarity scores. |
|
|
|
|
|
|
|
|
<!-- code in streamlit --> |
|
|
|
|
|
This file contains: |
|
|
|
|
|
UI Setup β Configures Streamlit layout & sidebar controls. |
|
|
CLIP Model Initialization β Loads the pre-trained CLIP model. |
|
|
Embedding Generation β Converts text and images into numerical vectors. |
|
|
Pinecone Search Queries β Finds similar images based on embeddings. |
|
|
Display Results β Shows search results in a grid layout. |
|
|
|
|
|
|
|
|
<!-- setup details --> |
|
|
1. Set Up Streamlit UI |
|
|
2. Initialize Pinecone |
|
|
3. Load CLIP Model & Processor |
|
|
4. Sidebar for Input Controls |
|
|
5. Text Search Processing |
|
|
6. Image Search Processing |
|
|
7. Function to Generate Text Embeddings |
|
|
8. Function to Generate Image Embeddings |
|
|
9. Pinecone Query to Find Similar Images |
|
|
10. Displaying Search Results |
|
|
11. Deployment on Hugging Face |
|
|
|
|
|
<!-- conclusion --> |
|
|
After deploying in hugging face the file runs and give the streamlit page of the CLIP-based Image & Text Search App. |