Backend API: auth, projects/images/annotations, R2 presign, tracing, thumbnails, pagination, tests, docs
This commit is contained in:
parent
5c5deed2f5
commit
f8ed08b854
49 changed files with 2626 additions and 0 deletions
59
config.yaml
Normal file
59
config.yaml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# Non-secret backend configuration. Secrets ONLY in .env.
|
||||
# Rule: .env decides WHO/WHERE (credentials, hosts), yaml decides HOW (layout, ttl, thresholds).
|
||||
app:
|
||||
name: danable
|
||||
api_prefix: /api/v1
|
||||
|
||||
api:
|
||||
default_page_size: 50
|
||||
max_page_size: 200
|
||||
upload_max_mb: 50
|
||||
|
||||
database:
|
||||
pool_size: 10
|
||||
max_overflow: 10
|
||||
|
||||
storage:
|
||||
bucket_default: danagble
|
||||
# R2 key layout. {project} = project slug, {image} = image id.
|
||||
layout:
|
||||
image: "datasets/{project}/{image}-{filename}"
|
||||
thumbnail: "datasets/{project}/thumbs/{image}.jpg"
|
||||
export: "artifacts/exports/{project}/{file}"
|
||||
model: "models/{name}/{version}.pt"
|
||||
embedding: "artifacts/embeddings/{project}/{image}.npy"
|
||||
presigned_ttl:
|
||||
put_seconds: 900 # upload direct-to-R2
|
||||
get_seconds: 3600 # preview/download
|
||||
export_seconds: 86400
|
||||
# Free-tier guardrails: small thumbs, embedding cache, no proxy of full images.
|
||||
thumbnail:
|
||||
enabled: true
|
||||
max_side: 512
|
||||
quality: 70
|
||||
|
||||
tasks:
|
||||
classification: { version: 1 }
|
||||
object_detection: { version: 1 }
|
||||
segmentation: { version: 1 }
|
||||
# voice: reserved for later (audio schema + sampler)
|
||||
|
||||
ai:
|
||||
enabled: true
|
||||
# registry only; heavy weights live on worker hosts, never in git.
|
||||
models:
|
||||
- { name: sam-vit-b, kind: segment, device: cpu, max_side: 1024, default: true }
|
||||
- { name: yolo-detect-m, kind: detect, device: cpu, conf_min: 0.35 }
|
||||
- { name: clf-resnet50, kind: classify, device: cpu }
|
||||
cache_embeddings: true # SAM image embedding reuse across point/box prompts
|
||||
|
||||
# Placeholder for the future traffic/monitoring layer (see src/middlewares/traffic.py).
|
||||
# Phase 1: in-process counters only. Phase 2: Prometheus + Grafana, R2 request accounting.
|
||||
traffic:
|
||||
enabled: true
|
||||
log_slow_ms: 800
|
||||
# Per-route R2 op budget alerts (Class A writes / Class B reads), enforced later.
|
||||
r2_budgets: { class_a_warn: 800000, class_b_warn: 8000000 }
|
||||
|
||||
export:
|
||||
formats: [coco_json, yolo_txt, labelme_json, mask_png]
|
||||
Loading…
Add table
Add a link
Reference in a new issue