# Step-by-step: Run NotebookLM Clone Locally You **do not have to** create a `.env` file. The app will run without it (it will use `MOCK_USER=localuser` automatically). A `.env` file is **optional** and useful if you want to set a custom username or use a Hugging Face token. --- ## Option A: Run without .env (fastest) 1. **Open a terminal** in the project folder: ```bash cd c:\Users\shail\Downloads\notebooklm__clone ``` 2. **Create a virtual environment** (recommended): ```bash python -m venv .venv ``` Then activate it: - **Windows (PowerShell):** `.\.venv\Scripts\Activate.ps1` - **Windows (CMD):** `.\.venv\Scripts\activate.bat` 3. **Install dependencies**: ```bash pip install -r requirements.txt ``` 4. **Run the app**: ```bash python app.py ``` If `MOCK_USER` is not set, the app sets it to `localuser` automatically. 5. **Open in browser**: Go to **http://localhost:7860** 6. **Use the app**: - Click **Create** to add a notebook (e.g. name it "My first notebook"). - Upload a **PDF**, **PPTX**, or **TXT** file, or paste a **URL** and click **Ingest URL**. - Click **Refresh sources** to see ingested sources. - Type a question in the chat and click **Send** (RAG will use your sources). - **Report, Quiz, and Podcast** require **GEMINI_API_KEY** (see Option B). Without it, the app shows a clear message and does not crash. Data is stored under the `data` folder in the project (e.g. `data/users/localuser/notebooks/...`). --- ## Option B: Run with a .env file (optional) Use this if you want a custom username or to use Hugging Face APIs (better embeddings and LLM). 1. **Create `.env`** from the example: - Copy `.env.example` to `.env` in the project root: ```bash copy .env.example .env ``` - Or create a new file named `.env` in `c:\Users\shail\Downloads\notebooklm__clone\` with at least: ``` MOCK_USER=localuser ``` 2. **Add GEMINI_API_KEY for artifacts** (report, quiz, podcast transcript): - Get a key at [https://aistudio.google.com/apikey](https://aistudio.google.com/apikey). - In `.env`, add: ``` GEMINI_API_KEY=your_key_here GEMINI_MODEL=gemini-1.5-flash ``` 3. **(Optional) Add your Hugging Face token** for better RAG and chat: - Go to [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) and create a token (read access is enough for inference). - In `.env`, add or uncomment: ``` HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` - Save the file. 4. **Then run as in Option A** (steps 2–6): activate venv, `pip install -r requirements.txt`, then `python app.py`. The app will load variables from `.env` automatically. --- ## Summary | Step | Action | |------|--------| | 1 | Open terminal in `notebooklm__clone` | | 2 | `python -m venv .venv` then activate (e.g. `.\.venv\Scripts\Activate.ps1`) | | 3 | `pip install -r requirements.txt` | | 4 | *(Optional)* Copy `.env.example` to `.env`; add **`GEMINI_API_KEY`** for artifacts (report/quiz/podcast); add `HF_TOKEN` for chat | | 5 | `python app.py` | | 6 | Open **http://localhost:7860** and create a notebook, ingest sources, then chat or generate artifacts | You need **GEMINI_API_KEY** for report/quiz/podcast generation; without it the app shows a clear message and does not crash. Use `.env` for Gemini key and optional HF token.