File size: 2,060 Bytes
fb2d883
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ── Web framework ────────────────────────────────────────────────────────────
fastapi==0.111.0            # async web framework β€” never use Flask (sync)
uvicorn[standard]==0.29.0   # ASGI server with websocket & HTTP/2 support
gunicorn==22.0.0            # multi-worker process manager for production
python-multipart==0.0.9     # required by FastAPI for form/file parsing

# ── Rate limiting ─────────────────────────────────────────────────────────────
slowapi==0.1.9              # per-IP rate limiting for FastAPI (no Redis needed)

# ── ML / Inference ────────────────────────────────────────────────────────────
torch==2.3.0                # PyTorch β€” CPU build on HF free tier (no CUDA)
transformers==4.40.0        # HuggingFace model + tokenizer loading
tokenizers==0.19.1          # fast Rust-based tokenizer (use_fast=True)
sentencepiece==0.2.0        # required by some tokenizer variants (RoBERTa-based)
safetensors==0.4.3          # fast, safe model weight format (replaces pytorch .bin)
accelerate==0.30.0          # enables low_cpu_mem_usage model loading

# ── Validation & utilities ────────────────────────────────────────────────────
pydantic==2.7.1             # request/response schema validation (FastAPI built-in)
numpy==1.26.4               # softmax probability array operations
httpx==0.27.0               # async HTTP client (useful for internal health probes)

# NOT included (inference-only β€” no training dependencies):
#   scipy, scikit-learn, matplotlib, pandas, datasets, evaluate
# Keeping the tree minimal = faster Space cold-start time