This project is a clone of Google's NotebookLM, designed to help users interact with their documents using AI. It consists of a Python Flask backend and a Next.js frontend.
You can access the live, deployed version of the application here:
- Frontend: https://nblm.akshaylilani.com
- Backend API: https://notebooklm-clone-backend-h5xf.onrender.com
- Document Upload: Upload PDF documents for processing.
- AI Chat: Ask questions and get answers based on the content of your uploaded PDFs.
- Citations: Get citations from the source documents for the AI-generated answers.
- Framework: Flask
- Vector Database: Chroma DB for storing and retrieving document embeddings.
- Embeddings: OpenAI's
text-embedding-ada-002
model to create vector representations of the text. - Language Model: OpenAI's o3 for generating responses.
- PDF Parsing: LlamaParse for extracting text from PDF documents.
- Text Splitting: Langchain's
RecursiveCharacterTextSplitter
to divide the extracted text into smaller chunks. - Token Counting: Tiktoken to count the number of tokens in the text.
Before you begin, ensure you have the following installed:
- Python 3.12+ (for the backend)
- Node.js 20+ and npm (for the frontend)
-
Navigate to the backend directory:
cd backend
-
Create and activate a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Environment Variables:
Create a
.env
file in thebackend/
directory based on.env.sample
:OPENAI_API_KEY
: Your API key from OpenAI.LLAMA_CLOUD_API_KEY
: For document parsing
-
Run the Backend Server:
gunicorn --worker-class gevent --workers 1 --bind 0.0.0.0:5000 app:app # Or for development with Flask's built-in server: # flask run --port 5000
The backend server should now be running at
http://localhost:5000
(or your specified port).
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Environment Variables:
Create a
.env
file in thefrontend/
directory based on.env.sample
:NEXT_PUBLIC_API_URL="http://0.0.0.0:5000"
NEXT_PUBLIC_API_URL
: The URL of your backend server. Make sure this matches the port you set for the backend.
-
Run the Frontend Development Server:
npm run dev
The frontend application should now be accessible at
http://localhost:3000
(or another port if 3000 is in use).
- Ensure both the backend and frontend servers are running.
- Open your web browser and navigate to
http://localhost:3000
. - Upload a PDF document using the provided interface.
- Once the document is processed, you can start asking questions related to its content.
You can also run the application using Docker.
-
Build Docker Images:
From the project root directory, run:
docker build -t notebooklm-backend ./backend docker build -t notebooklm-frontend ./frontend
-
Run Docker Containers:
Ensure you have your
.env
files configured in bothbackend/
andfrontend/
directories as described above.docker run -d -p 5000:5000 --name notebooklm-backend notebooklm-backend docker run -d -p 3000:3000 --name notebooklm-frontend notebooklm-frontend
The backend will be accessible at
http://localhost:5000
and the frontend athttp://localhost:3000
.