Tuana commited on
Commit
0e50607
·
1 Parent(s): 8a8d401

Fix HF Space

Browse files
Files changed (3) hide show
  1. README.md +2 -1
  2. app.py +7 -8
  3. requirements.txt +2 -0
README.md CHANGED
@@ -31,7 +31,7 @@ Users enter keys in the **API keys** panel in the app (password fields, session-
31
  | Variable | Where to get it |
32
  |----------|-----------------|
33
  | `ANTHROPIC_API_KEY` | [console.anthropic.com/settings/api-keys](https://console.anthropic.com/settings/api-keys) |
34
- | `TABPFN_API_TOKEN` | [ux.priorlabs.ai](https://ux.priorlabs.ai) → API Keys |
35
 
36
  Never commit keys to git. HF Space secrets are optional (auto-connect without showing keys in the UI).
37
 
@@ -147,6 +147,7 @@ Cold start can take 1–3 minutes because of TabPFN cloud fit + dependency insta
147
  | App times out on startup | Retry build; consider **CPU upgrade** in Space hardware settings |
148
  | Works locally but not on HF | Ensure `README.md` YAML has `sdk: gradio` and `app_file: app.py` |
149
  | `python:3.1: not found` | Quote the version in YAML: `python_version: "3.10"` (bare `3.10` parses as `3.1`) |
 
150
 
151
  ### 7. Updating the Space
152
 
 
31
  | Variable | Where to get it |
32
  |----------|-----------------|
33
  | `ANTHROPIC_API_KEY` | [console.anthropic.com/settings/api-keys](https://console.anthropic.com/settings/api-keys) |
34
+ | `TABPFN_API_TOKEN` | [ux.priorlabs.ai](https://ux.priorlabs.ai?utm_source=hf-demo&utm_medium=tuana) → API Keys |
35
 
36
  Never commit keys to git. HF Space secrets are optional (auto-connect without showing keys in the UI).
37
 
 
147
  | App times out on startup | Retry build; consider **CPU upgrade** in Space hardware settings |
148
  | Works locally but not on HF | Ensure `README.md` YAML has `sdk: gradio` and `app_file: app.py` |
149
  | `python:3.1: not found` | Quote the version in YAML: `python_version: "3.10"` (bare `3.10` parses as `3.1`) |
150
+ | `unhashable type: 'dict'` / localhost error | `starlette>=0.40` breaks Gradio 4.44 — use pinned `requirements.txt` |
151
 
152
  ### 7. Updating the Space
153
 
app.py CHANGED
@@ -271,7 +271,7 @@ HIDDEN = gr.update(visible=False)
271
  SHOW = gr.update(visible=True)
272
  LOADING_MD = (
273
  "⏳ **Please wait…** Running TabPFN prediction and computing "
274
- "Shapley attributions ([shapiq](https://docs.priorlabs.ai/capabilities/interpretability))."
275
  )
276
  FEATURES_HEADING = "#### Extracted Features"
277
  PROBS_HEADING = "#### Class Probabilities"
@@ -611,9 +611,9 @@ The CSV is downloaded from UCI on startup — no upload needed.
611
  with gr.Accordion("TabPFN API key (Prior Labs)", open=False):
612
  gr.Markdown(
613
  """
614
- Predictions run on **TabPFN-3** via the [Prior Labs](https://priorlabs.ai) cloud API:
615
 
616
- 1. Create an account at **[ux.priorlabs.ai](https://ux.priorlabs.ai)**
617
  2. Open **API Keys** in the dashboard
618
  3. Create a key and paste it below (with your Anthropic key)
619
 
@@ -627,7 +627,7 @@ Free-tier usage limits apply on Prior Labs; see their docs for current quotas.
627
  with gr.Accordion("🔑 API keys (required to predict)", open=False):
628
  gr.Markdown(
629
  "You need your own **Anthropic** key ([get one here](https://console.anthropic.com/settings/api-keys)) "
630
- "and **TabPFN** token ([Prior Labs](https://ux.priorlabs.ai) → API Keys). "
631
  + KEYS_PROMPT
632
  )
633
  with gr.Row():
@@ -750,7 +750,6 @@ Free-tier usage limits apply on Prior Labs; see their docs for current quotas.
750
  )
751
 
752
  if __name__ == "__main__":
753
- demo.queue().launch(
754
- server_name="0.0.0.0",
755
- server_port=int(os.environ.get("PORT", 7860)),
756
- )
 
271
  SHOW = gr.update(visible=True)
272
  LOADING_MD = (
273
  "⏳ **Please wait…** Running TabPFN prediction and computing "
274
+ "Shapley attributions ([shapiq](https://docs.priorlabs.ai/capabilities/interpretability?utm_source=hf-demo&utm_medium=tuana))."
275
  )
276
  FEATURES_HEADING = "#### Extracted Features"
277
  PROBS_HEADING = "#### Class Probabilities"
 
611
  with gr.Accordion("TabPFN API key (Prior Labs)", open=False):
612
  gr.Markdown(
613
  """
614
+ Predictions run on **TabPFN-3** via the [Prior Labs](https://priorlabs.ai?utm_source=hf-demo&utm_medium=tuana) cloud API:
615
 
616
+ 1. Create an account at **[ux.priorlabs.ai](https://ux.priorlabs.ai?utm_source=hf-demo&utm_medium=tuana)**
617
  2. Open **API Keys** in the dashboard
618
  3. Create a key and paste it below (with your Anthropic key)
619
 
 
627
  with gr.Accordion("🔑 API keys (required to predict)", open=False):
628
  gr.Markdown(
629
  "You need your own **Anthropic** key ([get one here](https://console.anthropic.com/settings/api-keys)) "
630
+ "and **TabPFN** token ([Prior Labs](https://ux.priorlabs.ai?utm_source=hf-demo&utm_medium=tuana) → API Keys). "
631
  + KEYS_PROMPT
632
  )
633
  with gr.Row():
 
750
  )
751
 
752
  if __name__ == "__main__":
753
+ # HF Spaces sets GRADIO_SERVER_NAME / PORT; avoid manual launch args that
754
+ # break health checks. Starlette must stay <0.40 for Gradio 4.44 (see requirements).
755
+ demo.queue().launch()
 
requirements.txt CHANGED
@@ -1,4 +1,6 @@
1
  gradio==4.44.1
 
 
2
  huggingface_hub>=0.19.3,<1.0
3
  anthropic>=0.25.0
4
  tabpfn-client>=0.3.0
 
1
  gradio==4.44.1
2
+ starlette>=0.35.0,<0.40.0
3
+ fastapi>=0.100.0,<0.116.0
4
  huggingface_hub>=0.19.3,<1.0
5
  anthropic>=0.25.0
6
  tabpfn-client>=0.3.0