Spaces:
Configuration error
Configuration error
File size: 6,364 Bytes
88f8604 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | # π Antigravity Notebook - Quick Start Guide
Get up and running with Antigravity Notebook in 5 minutes!
## Step 1: Prerequisites
Ensure you have:
- β
Python 3.9 or higher
- β
Docker & Docker Compose
- β
CUDA GPU (recommended, 16GB+ VRAM) or CPU (slower)
- β
~20GB free disk space (for model + data)
## Step 2: Installation
### Clone & Install
```bash
# Clone the repository
git clone <your-repo-url>
cd antigravity-notebook
# Install Python dependencies
pip install -r requirements.txt
```
### Configure Environment
```bash
# Copy environment template
cp .env.example .env
# (Optional) Edit .env if you want custom settings
# Default settings work out of the box!
```
## Step 3: Start PostgreSQL
```bash
# Start PostgreSQL with Docker Compose
docker-compose up -d
# Verify it's running
docker ps
```
You should see a container named `antigravity_postgres` running.
## Step 4: Initialize Database
```bash
# Create database tables
python -m backend.database
```
You should see: `β
Database initialized successfully!`
## Step 5: Start Backend API
```bash
# Start the FastAPI backend
python -m backend.main
```
Wait for:
```
β
CLaRa model loaded!
β
Antigravity Notebook is ready!
π API: http://0.0.0.0:8000
π Docs: http://0.0.0.0:8000/docs
```
**Note**: First startup takes ~5 minutes to download CLaRa-7B model (14GB).
## Step 6: Start Frontend UI
Open a **new terminal** and run:
```bash
# Start Streamlit UI
streamlit run frontend/app_notebook.py
```
Your browser should automatically open to `http://localhost:8501`
## Step 7: Create Your First Notebook
### In the Streamlit UI:
1. **Create a Notebook**
- Click "Create New Notebook" in the sidebar
- Name it "My First Notebook"
- Add a description (optional)
- Click "Create Notebook"
2. **Add a Source**
- Choose one of:
- **PDF**: Upload a PDF file
- **URL**: Paste a webpage URL (e.g., Wikipedia article)
- **Text**: Paste some text content
Example URL to try: `https://en.wikipedia.org/wiki/Artificial_intelligence`
3. **Wait for Processing**
- The source will be compressed into latent tensors
- PDF (50 pages): ~30 seconds
- URL: ~20 seconds
- Text: ~10 seconds
4. **Ask a Question**
- Type a query in the chat box
- Example: "What are the main points discussed in this document?"
- Press Enter
- Wait ~10 seconds for response
5. **View Sources**
- Click "Sources" under the response to see which sources were cited
- Check the Memory Usage gauge to see context utilization
## π You're Done!
You now have a working NotebookLM clone!
## π Next Steps
### Try These Examples:
#### Example 1: Research Assistant
1. Create a notebook called "AI Research"
2. Add these Wikipedia URLs:
- https://en.wikipedia.org/wiki/Artificial_intelligence
- https://en.wikipedia.org/wiki/Machine_learning
- https://en.wikipedia.org/wiki/Deep_learning
3. Ask: "Compare and contrast AI, ML, and Deep Learning"
#### Example 2: Document Analysis
1. Create a notebook called "Company Docs"
2. Upload 3-5 PDF reports or documents
3. Ask: "Summarize the key findings across all documents"
#### Example 3: Web Research
1. Create a notebook called "Topic Research"
2. Add 5-10 URLs about a topic you're interested in
3. Ask questions that require synthesizing information across sources
## π οΈ Common Issues
### Issue: "Database connection failed"
**Solution**: Ensure PostgreSQL is running
```bash
docker-compose up -d
docker ps # Check if container is running
```
### Issue: "CUDA out of memory"
**Solution**: Use CPU mode
```bash
# Edit .env
DEVICE=cpu
```
### Issue: "Model download is slow"
**Solution**: Be patient! CLaRa-7B is 14GB. It only downloads once.
Check progress at: `./model_cache/`
### Issue: "PDF extraction failed"
**Solution**: Ensure PDF has extractable text (not scanned images)
### Issue: "URL scraping failed"
**Solution**: Some websites block scraping. Try a different URL.
## π§ Configuration Tips
### For CPU-Only Systems
Edit `.env`:
```env
DEVICE=cpu
```
### For Limited Memory
Reduce context window in `.env`:
```env
MAX_CONTEXT_TOKENS=16384 # Half the default
```
### For Production Use
1. **Change database password**:
```env
POSTGRES_PASSWORD=<secure-password>
```
2. **Set secret key**:
```env
SECRET_KEY=<random-secure-key>
```
3. **Configure CORS** in `backend/main.py`:
```python
allow_origins=["https://your-frontend-domain.com"]
```
## π Monitoring
### Check API Health
```bash
curl http://localhost:8000/health
```
### View Storage Stats
```bash
curl http://localhost:8000/stats
```
### API Documentation
Open: http://localhost:8000/docs
Try the interactive API explorer!
## π§ͺ Testing the API Directly
### Create a Notebook
```bash
curl -X POST http://localhost:8000/notebooks/ \
-H "Content-Type: application/json" \
-d '{"name": "Test Notebook", "description": "API test"}'
```
### List Notebooks
```bash
curl http://localhost:8000/notebooks/
```
### Add Text Source
```bash
curl -X POST http://localhost:8000/sources/notebooks/<NOTEBOOK_ID>/sources/text \
-H "Content-Type: application/json" \
-d '{
"title": "Test Document",
"content": "This is a test document with some content to analyze."
}'
```
### Query Notebook
```bash
curl -X POST http://localhost:8000/chat/notebooks/<NOTEBOOK_ID>/chat \
-H "Content-Type: application/json" \
-d '{"query": "What is this document about?"}'
```
## π Learning More
- **Read the Plan**: See `ANTIGRAVITY_PLAN.md` for architecture details
- **Explore the Code**: Check out:
- `backend/services/context_manager.py` - The "brain"
- `backend/models/clara.py` - CLaRa wrapper
- `backend/services/ingestion.py` - Multi-modal processing
## π‘ Pro Tips
1. **Start Small**: Begin with 1-2 sources to understand the system
2. **Check Memory Usage**: Watch the gauge to see when you hit limits
3. **Use Descriptive Titles**: Makes it easier to understand citations
4. **Mix Source Types**: PDFs + URLs + Text work great together
5. **Ask Synthesis Questions**: The AI excels at combining information
## π Need Help?
- **Documentation**: See `README.md`
- **API Docs**: http://localhost:8000/docs
- **Issues**: Open a GitHub issue
- **Logs**: Check terminal output for debugging
---
**Happy NotebookLM-ing! π**
|