This is a semantic search application (similar to Quora) built using FastAPI, Pinecone, and Sentence Transformers. The application allows users to input text, which is then processed and queried against a Pinecone vector database to find the most relevant matches of questions from quora.
- FastAPI: A modern, fast (high-performance) web framework for building APIs with Python 3.6+.
- Pinecone: A vector database for machine learning applications. It is used to store and query high-dimensional vectors.
- Sentence Transformers: A library for sentence embeddings using transformer models.
-
Get /: Returns the homepage.
-
Post /process: Returns the search results
The application uses Pinecone to store and query vectors. The Pinecone API key is stored in the .env file.
- The application creates a Pinecone index with the name
quora-index. - The vectors are stored in the Pinecone index using the
upsertmethod. - The vectors are queried using the
querymethod.
The application uses Sentence Transformers to encode the input text and the stored vectors. The Sentence Transformers model is loaded using the sentence-transformers/all-MiniLM-L6-v2 model.
Installation & Usage
git clone <repository-url> cd <repository-directory>Install the required dependencies using the requirements.txt file.
fastapi==0.70.0 uvicorn==0.15.0 jinja2==3.0.2 python-dotenv==0.19.2 pinecone-client==2.0.0 sentence-transformers==2.1.0The command to install the dependencies is:
pip install -r requirements.txtCreate a .env file in the root directory and add the following environment variables:
PINECONE_API_KEY=<your-pinecone-api-key>uvicorn main:app --reloadThe application will be running at http://127.0.0.1:8000.
Enter some text in the input box and click on the "Search" button to find the most relevant matches.
Contributions are welcome! Please feel free to submit a PR or open an issue if you encounter any problems.


