This project is a web application that offers a modern user interface for uploading and searching documents using natural language. It consists of two main components: a Vite React app for the user interface, and a Python Flask server for handling all the logic.
The project is organized into two main folders:
ui: Contains the Vite React app for the user interface. Users can upload documents and search through them using an intuitive, modern UI. server: Contains the Python Flask server, which has several endpoints defined for fetching already indexed documents, indexing new documents using the OpenAI embeddings API, and searching documents using natural language.
Follow these steps to set up the project and run it locally:
Prerequisites Make sure you have Node.js (version 18.x or later) and Python (version 3.7 or later) installed on your system.
From the project root navigate to the ui folder:
cd ui
Install the dependencies:
npm install
Start the Vite React app:
npm run dev
The app should now be running at http://localhost:5173.
Server Setup From the project root, navigate to the server folder:
cd server
(Optional) Create a virtual environment:
python -m venv embeddings-search
Activate the virtual environment: On macOS and Linux:
source my_project_env/bin/activate
On Windows:
.\my_project_env\Scripts\activate
Install the dependencies:
pip install -r requirements.txt
Create a .env file in the server folder and add your OpenAI API key: OPENAI_API_KEY=your_openai_api_key_here
Start the Flask server:
python app.py
The server should now be running at http://localhost:5000.
Usage With both the UI and server running, you can now access the web application at http://localhost:5173. Upload documents and search through them using natural language queries.