soranz84 commited on
Commit
5404128
·
verified ·
1 Parent(s): 5886b49

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -1
README.md CHANGED
@@ -8,4 +8,28 @@ pinned: false
8
  short_description: Soil PSD analysis API (grai4 model with 11 softmax classes)
9
  ---
10
 
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  short_description: Soil PSD analysis API (grai4 model with 11 softmax classes)
9
  ---
10
 
11
+ # GRAI Soil Analysis API v4.0
12
+
13
+ API for soil particle size distribution analysis from images.
14
+ Powered by **graiv4** model -- 11 PSD classes (softmax).
15
+
16
+ **Usage tracking is persisted to a private HF Bucket via the API** -- no volume mount needed, so the bucket stays private even on a public Space.
17
+
18
+ ## Setup: Private Bucket for Persistent Usage Tracking
19
+
20
+ 1. Go to **huggingface.co/buckets** -- create a **private** bucket, e.g. `soranz84/grai-usage`
21
+ 2. Go to **huggingface.co/settings/tokens** -- create a **fine-grained** token with **write access to buckets**
22
+ 3. In your Space **Settings > Repository secrets**, add:
23
+ - `HF_BUCKET_NAME` = `soranz84/grai-usage`
24
+ - `BUCKET_TOKEN` = *(your new write-capable token)*
25
+ 4. **Do NOT mount the bucket** -- the app reads/writes via the API only
26
+ 5. Rebuild the Space
27
+
28
+ The app saves `auth.db` and `usage_tracking.db` to the bucket every 10 requests, and loads them back on startup. The bucket stays completely private.
29
+
30
+ ## Billing Endpoints
31
+
32
+ | Endpoint | Auth | Description |
33
+ |---|---|---|
34
+ | `GET /my-usage` | x-api-key | Your personal call count |
35
+ | `GET /admin/all-usage` | admin key | All users' call counts |