cmboulanger commited on
Commit
c99a48b
Β·
1 Parent(s): 10dae35

docs/deps: update HF deployment guide, pin gradio>=6.9, document HF_TOKEN scope requirement

Browse files
README.md CHANGED
@@ -314,10 +314,12 @@ Two interfaces are provided:
314
 
315
  ```bash
316
  uv sync --extra gradio
317
- uv run python app.py
318
- # opens at http://localhost:7860 β€” click "Sign in with HuggingFace" to authenticate
319
  ```
320
 
 
 
321
  ### Running the FastAPI webservice locally
322
 
323
  ```bash
 
314
 
315
  ```bash
316
  uv sync --extra gradio
317
+ HF_TOKEN=hf_... uv run python app.py
318
+ # opens at http://localhost:7860
319
  ```
320
 
321
+ Set `HF_TOKEN` to a token with the **"Make calls to Inference Providers"** scope ([create/edit tokens here](https://huggingface.co/settings/tokens)). You can also put it in a `.env` file at the repo root instead of passing it inline.
322
+
323
  ### Running the FastAPI webservice locally
324
 
325
  ```bash
docs/huggingface-deployment.md CHANGED
@@ -15,11 +15,15 @@ HF generates a `README.md` with YAML frontmatter. Make sure it contains at minim
15
  ```yaml
16
  ---
17
  sdk: gradio
18
- sdk_version: "5.0"
 
19
  app_file: app.py
 
20
  ---
21
  ```
22
 
 
 
23
  ## Step 2 β€” Push the repository
24
 
25
  ```bash
@@ -37,6 +41,8 @@ In your Space's **Settings β†’ Variables and Secrets**, add a **Secret**:
37
  | --- | --- |
38
  | `HF_TOKEN` | Your HuggingFace API token ([create one here](https://huggingface.co/settings/tokens)) |
39
 
 
 
40
  The app shows a setup warning if this secret is missing.
41
 
42
  ## Step 4 β€” Verify
@@ -55,7 +61,13 @@ Models are defined in `app.py` (`_HF_MODELS`), mirrored in `webservice/main.py`.
55
 
56
  ```bash
57
  uv sync --extra gradio
58
- uv run python app.py
59
  # opens at http://localhost:7860
60
- # click "Sign in with HuggingFace" β€” redirects through HF OAuth, then back to localhost
 
 
 
 
 
 
61
  ```
 
15
  ```yaml
16
  ---
17
  sdk: gradio
18
+ sdk_version: "6.9.0"
19
+ python_version: "3.12"
20
  app_file: app.py
21
+ hardware: cpu-basic
22
  ---
23
  ```
24
 
25
+ > **Why `cpu-basic`?** The app makes HTTP calls to external LLM APIs β€” it does not run any local GPU workloads. Using `cpu-basic` avoids the GPU-slot allocation overhead (5–15 s per request) and GPU-task timeout issues that come with ZeroGPU (`zero-a10g`) hardware.
26
+
27
  ## Step 2 β€” Push the repository
28
 
29
  ```bash
 
41
  | --- | --- |
42
  | `HF_TOKEN` | Your HuggingFace API token ([create one here](https://huggingface.co/settings/tokens)) |
43
 
44
+ > **Token permissions required:** The token must have the **"Make calls to Inference Providers"** scope enabled (under "Inference" when creating/editing the token at https://huggingface.co/settings/tokens). Without this scope, all annotation and evaluation calls will return HTTP 403.
45
+
46
  The app shows a setup warning if this secret is missing.
47
 
48
  ## Step 4 β€” Verify
 
61
 
62
  ```bash
63
  uv sync --extra gradio
64
+ HF_TOKEN=hf_... uv run python app.py
65
  # opens at http://localhost:7860
66
+ ```
67
+
68
+ Set `HF_TOKEN` to a token with the "Make calls to Inference Providers" scope. You can also put it in a `.env` file at the repo root:
69
+
70
+ ```bash
71
+ echo "HF_TOKEN=hf_..." > .env
72
+ uv run python app.py
73
  ```
pyproject.toml CHANGED
@@ -18,7 +18,7 @@ webservice = [
18
  "uvicorn[standard]>=0.30",
19
  "python-multipart>=0.0.9",
20
  ]
21
- gradio = ["gradio>=5.0"]
22
 
23
  [tool.pytest.ini_options]
24
  addopts = "-m 'not integration'"
 
18
  "uvicorn[standard]>=0.30",
19
  "python-multipart>=0.0.9",
20
  ]
21
+ gradio = ["gradio>=6.9"]
22
 
23
  [tool.pytest.ini_options]
24
  addopts = "-m 'not integration'"
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  # HuggingFace Spaces β€” install the package and its gradio extra.
2
  # Spaces reads this file automatically; no pyproject.toml extras support needed.
3
- gradio>=5.0
4
  jinja2>=3.1
5
  lxml>=5.0
6
  python-dotenv>=1.2.2
 
1
  # HuggingFace Spaces β€” install the package and its gradio extra.
2
  # Spaces reads this file automatically; no pyproject.toml extras support needed.
3
+ gradio>=6.9
4
  jinja2>=3.1
5
  lxml>=5.0
6
  python-dotenv>=1.2.2