Files
jobtrackingapp/tools/summarizer/README.md
T
2026-03-21 11:55:27 +01:00

33 lines
981 B
Markdown

# Local Hugging Face Summarizer
This small service runs a Hugging Face summarization model locally and exposes a simple HTTP API.
Install (recommended: virtualenv)
Windows (CPU PyTorch wheel may be required):
```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
# If torch wheel installation is needed, follow instructions at https://pytorch.org
python -m uvicorn app:app --host 127.0.0.1 --port 8001 --workers 1
```
Linux / macOS:
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m uvicorn app:app --host 127.0.0.1 --port 8001 --workers 1
```
API
- `GET /health` — health check
- `POST /summarize` — JSON body `{ "text": "...", "max_length": 150, "min_length": 30 }` returns `{ "summary": "...", "cached": false }`
Notes
- Model will be downloaded on first run and can be several hundred MB.
- For lower memory usage, consider `sshleifer/tiny-distilbart-cnn-6-6` or `t5-small`.