File size: 1,791 Bytes
38c016b |
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 |
# Local Development Setup
## Quick Start
```bash
# Install all dependencies (same as production)
pip install -r requirements.txt
```
## Python Version Support
- **Recommended**: Python 3.10-3.12
- **Minimum**: Python 3.10 (matches Docker)
## Installation Troubleshooting
### If you get PyTorch installation errors:
```bash
# Install PyTorch first with CPU support
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
# Then install remaining dependencies
pip install -r requirements-local.txt --no-deps
pip install fastapi uvicorn[standard] python-dotenv python-multipart
```
### For M1/M2 Macs:
```bash
# Use conda for better compatibility
conda install pytorch::pytorch torchvision torchaudio -c pytorch
pip install -r requirements-local.txt --no-deps
pip install sentence-transformers faiss-cpu transformers huggingface-hub
```
## Running Locally
```bash
cd crossword-app/backend-py
python app.py
```
The server will start on http://localhost:7860
## Features Available
### Features Available:
- ✅ AI word generation via vector search
- ✅ 30K+ vocabulary from sentence-transformers
- ✅ Static word fallback
- ✅ All crossword features
- ✅ Same as production environment
## Environment Variables
Create a `.env` file:
```bash
# Optional - defaults to sentence-transformers/all-mpnet-base-v2
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
# Optional - similarity threshold for AI words
WORD_SIMILARITY_THRESHOLD=0.65
# Optional - logging level
LOG_LEVEL=INFO
```
## Testing
```bash
# Test basic components
python test_local.py
# Test with pytest
pytest
```
## Docker vs Local Development
Both use the same `requirements.txt` with modern, compatible versions that work across Python 3.9-3.12 and different platforms. |