apingali Claude Opus 4.7 (1M context) commited on
Commit
61393d7
Β·
1 Parent(s): 8f09671

chore(compounding-test): hide HuggingFace API option from dropdowns

Browse files

The HF Inference Providers backend requires the Space owner to have
HF billing set up (credit card on file OR custom per-provider API
keys). Without either, every call fails with the misleading
"model_not_supported" error β€” even for ungated, fully-enabled models.
That's HF UX, not our code: providers being "enabled" in the toggle
list just means available; actually USING them needs a billing path.

For our specific Space, the owner doesn't have HF billing configured
and doesn't want to (the Pro plan's included credits should cover it
in theory but the routing requires the billing setup regardless).
Two backends already work cleanly without billing setup:
- ZeroGPU (free; on the Space's GPU; quota-limited)
- Anthropic (visitor pastes their own API key)

Removed the HF option from both UIs to avoid opaque-failure friction:
- gradio-apps/compounding-test/app.py (Space's dropdown)
- src/components/CompoundingTestAI.tsx (site's dropdown)

What's preserved (intentionally):
- _call_huggingface and the "huggingface" key in PROVIDERS dict β€”
backend remains reachable via MODEL_PROVIDER env override for
users who do set up HF billing
- All 31 tests pass (the routing tests still cover the backend)
- _detect_provider precedence unchanged

What's updated:
- Intro markdown rewritten for 2 options instead of 3
- Dropdown comments document why the option is hidden so future
contributors don't accidentally re-enable it without addressing
the billing requirement

Verified: 31 pytest + Astro build clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -743,19 +743,22 @@ def build_demo():
743
  """Build and return the Gradio Blocks UI. Called only by __main__."""
744
  import gradio as gr
745
 
746
- # Free options first, premium last. Plain-English labels with no
747
- # ANTHROPIC_API_KEY / HF_TOKEN / SPACE_ID jargon β€” the casual user
748
  # shouldn't have to know what any of those mean.
 
 
 
 
 
 
 
749
  provider_choices = []
750
  if _zerogpu_available():
751
  provider_choices.append((
752
  f"Free Β· Phi-4-mini-instruct (Microsoft) β€” runs on GPU",
753
  "zerogpu",
754
  ))
755
- provider_choices.append((
756
- f"Free Β· Gemma 2 9B (Google) β€” runs via HuggingFace",
757
- "huggingface",
758
- ))
759
  provider_choices.append((
760
  f"Premium Β· Claude Opus 4.7 (Anthropic) β€” paste your API key below",
761
  "anthropic",
@@ -771,9 +774,10 @@ def build_demo():
771
  "Describe your AI initiative β€” get a scored writeup in one of "
772
  "four outcomes: **compounder**, **one-shot win**, **compounding "
773
  "the wrong thing**, or **Roman Candle**.\n\n"
774
- "**The default model is free.** Pick **Premium Β· Claude Opus** "
775
- "from the dropdown if you have an Anthropic API key and want "
776
- "the highest-quality writeup. Read the full framework at "
 
777
  "[mile-hi.ai/journal/the-berkshire-test]("
778
  "https://www.mile-hi.ai/journal/the-berkshire-test)."
779
  )
 
743
  """Build and return the Gradio Blocks UI. Called only by __main__."""
744
  import gradio as gr
745
 
746
+ # Free option first, premium second. Plain-English labels with no
747
+ # ANTHROPIC_API_KEY / SPACE_ID / ZeroGPU jargon β€” the casual user
748
  # shouldn't have to know what any of those mean.
749
+ #
750
+ # The HuggingFace Inference Providers backend (provider="huggingface")
751
+ # is intentionally NOT in this dropdown: it requires the Space owner
752
+ # to have HF billing set up (credit card on file OR custom provider
753
+ # API keys), which most Pro users don't have by default. The backend
754
+ # code remains in PROVIDERS so it's reachable via MODEL_PROVIDER env
755
+ # override for users who do set up billing β€” see README.md.
756
  provider_choices = []
757
  if _zerogpu_available():
758
  provider_choices.append((
759
  f"Free Β· Phi-4-mini-instruct (Microsoft) β€” runs on GPU",
760
  "zerogpu",
761
  ))
 
 
 
 
762
  provider_choices.append((
763
  f"Premium Β· Claude Opus 4.7 (Anthropic) β€” paste your API key below",
764
  "anthropic",
 
774
  "Describe your AI initiative β€” get a scored writeup in one of "
775
  "four outcomes: **compounder**, **one-shot win**, **compounding "
776
  "the wrong thing**, or **Roman Candle**.\n\n"
777
+ "**The default is free** β€” runs an open model (Phi-4-mini) "
778
+ "on this Space's GPU. Pick **Premium Β· Claude Opus** from "
779
+ "the dropdown if you have an Anthropic API key and want the "
780
+ "highest-quality writeup. Read the full framework at "
781
  "[mile-hi.ai/journal/the-berkshire-test]("
782
  "https://www.mile-hi.ai/journal/the-berkshire-test)."
783
  )