system HF Staff commited on
Commit
b79fb38
Β·
verified Β·
1 Parent(s): 50ba853

deploy: sync encoder from 26315a9

Browse files
Files changed (1) hide show
  1. README.md +32 -5
README.md CHANGED
@@ -10,12 +10,39 @@ pinned: false
10
 
11
  # Reflections SigLIP text-query encoder
12
 
13
- Embeds a natural-language query into a 768-d L2-normalized vector using the
14
- SigLIP2 text tower (`onnx-community/siglip2-base-patch16-256-ONNX`), in the same
15
- cosine space as the photo image embeddings.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  - `POST /encode` β€” `{ "query": "..." }` β†’ `{ "vector": [768 floats] }`. Requires
18
  `Authorization: Bearer $SIGLIP_ENCODER_TOKEN`.
19
- - `GET /health` β€” liveness for the keep-warm cron.
 
 
20
 
21
- Set the Space secret `SIGLIP_ENCODER_TOKEN`. The model is baked into the image.
 
 
 
 
 
 
10
 
11
  # Reflections SigLIP text-query encoder
12
 
13
+ Embeds a natural-language search query into a 768-d L2-normalized vector using the
14
+ SigLIP2 text tower (`onnx-community/siglip2-base-patch16-256-ONNX`) β€” the same
15
+ checkpoint the photo image embeddings use, so query and image vectors share one
16
+ cosine space. The model is baked into the Docker image at build time and stays
17
+ resident in RAM, so requests never pay a download or load cost.
18
+
19
+ ## How it fits in
20
+
21
+ ```
22
+ Browser ──/gallery?q=…──▢ Vercel web app
23
+ β”‚ POST /encode (Bearer $SIGLIP_ENCODER_TOKEN)
24
+ β–Ό
25
+ this Space ──▢ {vector:[768]} (model resident in RAM)
26
+ β”‚
27
+ Vercel cosine-ranks that vector against image embeddings in Neon (pgvector)
28
+ β–Ό
29
+ ranked photos
30
+
31
+ Deploy: push to main (encoder/**) ─▢ GitHub Actions ─(OIDC, no stored token)─▢ hf upload ─▢ Space rebuilds
32
+ Warm: GitHub Actions cron ─every 6h─▢ GET /health (keeps the Space under HF's 48h sleep)
33
+ ```
34
+
35
+ ## API
36
 
37
  - `POST /encode` β€” `{ "query": "..." }` β†’ `{ "vector": [768 floats] }`. Requires
38
  `Authorization: Bearer $SIGLIP_ENCODER_TOKEN`.
39
+ - `GET /health` β€” open liveness check for the keep-warm cron.
40
+
41
+ ## Operating
42
 
43
+ - **Secret:** set `SIGLIP_ENCODER_TOKEN` on the Space; it must match the web app's
44
+ value (the web app sends it as the bearer token).
45
+ - **Deploy:** automatic on push to `main` touching `encoder/**`, via Trusted
46
+ Publishing (OIDC) β€” no HF token is stored anywhere.
47
+ - **Model:** downloaded once during the image build and baked in; container
48
+ starts (including post-sleep wakes) load it from local disk, never the network.