huggingface-spaces
Build, deploy, and maintain applications on Hugging Face Spaces — Gradio / Docker / Static SDKs, ZeroGPU and dedicated hardware, model loading, debugging…
Skill by huggingfaceOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/huggingface-huggingface-spaces
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: devops, ml, model-inference, backend-development
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/huggingface-spaces
What's inside
- Skill name
huggingface-spaces- Description
- Build, deploy, and maintain applications on Hugging Face Spaces — Gradio / Docker / Static SDKs, ZeroGPU and dedicated hardware, model loading, debugging, buckets, inference providers, community grants. Use whenever the user asks to create or host an app on Hugging Face, port code onto ZeroGPU, fix a Space that won't build or run, or otherwise work with `hf spaces …`, `@spaces.GPU`, Space README frontmatter, or the `spaces` Python package.
- License
- Apache-2.0
- Instructions
- 239 lines in SKILL.md · view on GitHub
Files (15)
- README.md
- SKILL.md
- 3d-cuda-extensions.md · references/
- 3d-generation.md · references/
- 3d-gsplat.md · references/
- 3d-models.md · references/
- 3d-outputs.md · references/
- buckets.md · references/
- debugging.md · references/
- gradio.md · references/
- grants.md · references/
- inference-providers.md · references/
- known-errors.md · references/
- requirements.md · references/
- zerogpu.md · references/
SKILL.md (first lines)
# Hugging Face Spaces
Hugging Face Spaces host machine-learning applications. There are 1M+ today; each Space is a git repo. This skill covers creating, building, debugging, and maintaining them.
## 0. Getting ready
Before anything else:
1. Check the `hf` CLI is installed: `which hf`. If not, `pip install -U huggingface_hub`.
2. Check the user is logged in: `hf auth whoami`. If not, run `hf auth login` — it prints a URL and a one-time code; ask the user to open the URL and enter the code, then login completes automatically (OAuth, no token needed). Alternatively, pass a write-scoped token from https://huggingface.co/settings/tokens with `--token`.
3. Note `whoami`'s `canPay` and `isPro` flags — they gate hardware choices below. A free (`isPro=False`) account can only host Static Spaces and up to 2 ZeroGPU Spaces.
The `hf-cli` skill teaches an agent every `hf` command and is the recommended companion to this one. Install it with `hf skills add hf-cli` (add `--claude --global` to install for Claude Code as well, user-level).
## 1. What a Space is
A Space is a git repo with three possible SDKs:
- **Gradio** — most Spaces. Python, fast iteration, supports ZeroGPU.
- **Docker** — arbitrary container. Use when you need a non-Python stack or a pre-built template (Streamlit, Argilla, Shiny, etc. — full list at https://huggingface.co/docs/hub/spaces-sdks-docker). Does **not** support ZeroGPU.
- **Static** — plain HTML, or a React/Svelte/Vue project built at deploy time. Use for in-browser ML (transformers.js / WebGPU / WebAssembly / onnxruntime-web), project pages, interactive reports, or Spaces that orchestrate other Spaces. No hardware needed.
### Hardware tiers
Static Spaces are free for everyone and need no hardware. **Gradio and Docker Spaces run on compute and require a paid plan to create** — PRO for personal accounts, Team or Enterprise for organizations — with one exception: **free personal accounts in good standing (verified email, account older than 30 days) can host up to 2 ZeroGPU Spaces.**
So on a free account ZeroGPU is the *only* way to host a Gradio Space. `cpu-basic` is not the safe fallback it used to be — it is gated too.
**ZeroGPU (`zero-a10g`)** — dynamic, per-request GPU allocation on NVIDIA RTX PRO 6000 Blackwell (sm_120). Two sizes: `large` (half MIG, 48 GB, 1× quota) and `xlarge` (full, 96 GB, 2× quota). Free for the Space creator; Space visitors consume their own daily quota (~5 min free / 40 min Pro / 60 min Enterprise). **Gradio-only**, **PyTorch-first**. Hosting caps per account: **2** free personal, **10** PRO, **50** Team / Enterprise org.
**`cpu-basic`** — 2 vCPU / 16 GB, no hourly cost but needs a paid plan. For data viz, API-proxy Spaces, small CPU-bound models.
**Dedicated GPU** (T4, L4, A10G, L40S, A100, H200) — billed to the Space creator by the hour. List + pricing: `hf spaces hardware`. Only the creator can attach these, and only if `canPay=True`. Use when ZeroGPU genuinely doesn't fit — non-PyTorch main model with heavy init, very-large-model long-context inference, etc.
If the user needs hardware they can't pay for — a dedicated GPU, or a Gradio Space beyond the free 2-ZeroGPU cap — they can still create a **Static** Space (free for everyone), push the app there, and request a community grant. See [`references/grants.md`](references/grants.md).
For the authoritative reference: https://huggingface.co/docs/hub/spaces-overview
## 2. Look for an existing demo first
Before deciding how to build anything, search for prior art:
```bash
hf spaces search "<model name or task>" --sdk gradio --limit 10
```
If someone has built a similar Space, read its `app.py` and `requirements.txt` — that gives you the working pattern. Saves a lot of blind iteration. Mention to the user what you found before committing to an approach.
## 3. Decide SDK and hardware
Follow the user's explicit request first. If they were vague:
- **Default for a public ML demo**: Gradio + ZeroGPU. Use this unless something below applies.
- **The model's only inference path is non-PyTorch** (ONNX / TF / JAX / vLLM as the MAIN model, with heavy init): dedicated GPU.
- But: marginal non-torch tools (a small ONNX preprocessor, a TF utility) inside a torch-main pipeline are fine on ZeroGPU. The hijack only patches torch; init the non-torch lib inside `@spaces.GPU` and pay the short per-call init cost.
- **Tiny / CPU-bound model, or API-proxy Space**: `cpu-basic` — but it needs a paid plan. On a free account, put it on `zero-a10g` with a no-op decorated function (ZeroGPU requires at least one) and keep the real work outside it — nothing ever requests a GPU, so no quota is burned. See [`references/inference-providers.md`](references/inference-providers.md).
- **Browser-side ML or project page**: Static.
- **Container with non-Python stack**: Docker.
### Sourcing the model
- **GitHub repo** — clone locally to read structure. If it already has a Gradio demo, the minimal viable path is to adapt it onto ZeroGPU (see [`references/zerogpu.md`](references/zerogpu.md)). Otherwise: read the README + inference code, prefer the PyTorch path, estimate VRAM (bf16 ≈ `params_B × 2` GB; 48 GB fits ≤24B params at bf16, or much larger with quantization — see [`references/zerogpu.md`](references/zerogpu.md) for quantization on ZeroGPU).
- **HF model repo** — read its README, follow any linked GitHub.
- **Paper / blog post** — look for an official or unofficial implementation. Don't reimplement unless trivial or the user explicitly asks.
- **Vague request** — search Spaces first; surface results.
If the model genuinely won't fit, check **Inference Providers** as an alternative: see [`references/inference-providers.md`](references/inference-providers.md). This avoids hosting the model at all.
## 4. Create the Space
```bash
hf repos create <namespace>/<name> --type space --space-sdk <gradio|docker|static> \
[--flavor zero-a10g|cpu-basic|<paid-flavor>] \
[--secrets KEY=val] [--env KEY=val] \
--public|--private|--protected \
--exist-ok
```
- `--space-sdk` is required.
- `--flavor` selects hardware. `zero-a10g` is the (legacy) identifier for ZeroGPU. Omitting it gives `cpu-basic` — which is itself gated behind a paid plan, so on a free account pass `--flavor zero-a10g` explicitly. Run `hf spaces hardware` for the full paid list and pricing.
- Visibility: `--public` (anyone can view), `--private` (only you), `--protected` (app is reachable but git repo / Files tab is private).
- `--secrets KEY=val` becomes an environment variable inside the Space and is **not** visible to visitors. Use for API keys, gated-repo tokens (`HF_TOKEN=hf_…`), etc. Can also be set later via `hf spaces secrets set <id> KEY=val`.
- `--env KEY=val` is **visible to visitors** — use only for non-sensitive config (`GRADIO_SSR_MODE=false`, `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True`, etc.).
> Note: `hardware:` in the README YAML is silently ignored — hardware is only set via `--flavor` at creation, or later via `hf spaces settings <id> --hardware <name>`.
## 5. Build the app
The Space now exists at `https://huggingface.co/spaces/<namespace>/<name>` but is empty.
### README.md frontmatter
Always required:
```yaml
---
title: ...
emoji: 🚀 # pick something representative
colorFrom: blue # red|yellow|green|blue|indigo|purple|pink|gray (only these)
colorTo: indigo
sdk: gradio # gradio | docker | static
sdk_version: 6.15.1 # latest stable unless you have a reason*
app_file: app.py # gradio only (docker / static use Dockerfile / index.html)
short_description: ... # ≤ 60 chars (server rejects longer)
python_version: "3.12" # ZeroGPU officially supports 3.10.13 and 3.12.12
startup_duration_timeout: 30m # default; bump to 1h for big LLMs / heavy downloads
---
```
\* Default to the current latest stable, and **look up what that is** (`pip index versions gradio`, or the version a freshly-created Space defaults to) — the number above is a placeholder that goes stale, don't reuse it. Only pin older when the latest genuinely doesn't work for this Space: a custom component pins it, or you're adapting an existing demo and don't want to rewrite for 5.x→6.x breaking changes. If you need a 5.x, pick `5.50.0` (latest of the series; still supports custom components).
All frontmatter options: https://huggingface.co/docs/hub/spaces-config-reference
### Minimal ZeroGPU Gradio app
```python
import spaces # MUST come before torch / diffusers / transformers
import torch
import gradio as grFrom huggingface/skills, Apache-2.0.
More from huggingface/skills
- 0.856score
trl-training
huggingfaceOfficial
Post-train LLMs with TRL (Transformers Reinforcement Learning) — SFT, DPO, GRPO, KTO, and reward-model training.
SkillAFreshness: A★ 11.2KClaude Code +9 - 0.856score
hf-cli
huggingfaceOfficial
Hugging Face Hub CLI (`hf`) for downloading, uploading, and managing models, datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face Hub.
SkillAFreshness: A★ 11.2KClaude Code +9 - 0.815score
hf-cloud-sagemaker-iam-preflight
huggingfaceOfficial
Ensure a usable SageMaker execution role exists before deploying or training.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
hf-cloud-serving-image-selection
huggingfaceOfficial
Pick the right serving container for a SageMaker model deployment and find its current image URI.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
hf-cloud-sagemaker-production-defaults
huggingfaceOfficial
Create a SageMaker endpoint (real-time, real-time scale-to-zero, or async) with autoscaling, CloudWatch alarms, and tagging enabled by default.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
train-sentence-transformers
huggingfaceOfficial
Train or fine-tune sentence-transformers models across `SentenceTransformer` (bi-encoder, dense or static embedding model for retrieval, similarity…
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.809score
hf-cloud-sagemaker-deployment-planner
huggingfaceOfficial
Plan and coordinate the deployment of a model to Amazon SageMaker AI.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.781score
huggingface-best
huggingfaceOfficial
Use when the user asks about finding the best, top, or recommended model for a task, wants to know what AI model to use, or wants to compare models by…
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.758score
huggingface-trackio
huggingfaceOfficial
Track and visualize ML training experiments with Trackio.
SkillCFreshness: C★ 11.2KClaude Code +9 - 0.758score
hf-cloud-python-env-setup
huggingfaceOfficial
Set up an isolated Python environment for SageMaker / AWS work, with the right Python version and current boto3.
SkillCFreshness: C★ 11.2KClaude Code +9 - 0.758score
huggingface-lora-space-builder
huggingfaceOfficial
Build and publish a Gradio demo on Hugging Face Spaces for a user-provided LoRA.
SkillCFreshness: C★ 11.2KClaude Code +9 - 0.758score
huggingface-zerogpu
huggingfaceOfficial
AI demos and GPU compute with Gradio Spaces and Hugging Face Spaces ZeroGPU.
SkillCFreshness: C★ 11.2KClaude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 11,208
- Forks
- 778
- Open issues
- 13
- Contributors
- 43
- Last commit (this folder)
- Aug 3, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/huggingface/skills
- Website
- huggingface.co
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from huggingface
- 0.856score
hf-cli
huggingfaceOfficial
Hugging Face Hub CLI (`hf`) for downloading, uploading, and managing models, datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face Hub.
SkillAFreshness: A★ 11.2KClaude Code +9 - 0.856score
trl-training
huggingfaceOfficial
Post-train LLMs with TRL (Transformers Reinforcement Learning) — SFT, DPO, GRPO, KTO, and reward-model training.
SkillAFreshness: A★ 11.2KClaude Code +9 - 0.815score
hf-cloud-sagemaker-production-defaults
huggingfaceOfficial
Create a SageMaker endpoint (real-time, real-time scale-to-zero, or async) with autoscaling, CloudWatch alarms, and tagging enabled by default.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
hf-cloud-serving-image-selection
huggingfaceOfficial
Pick the right serving container for a SageMaker model deployment and find its current image URI.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
train-sentence-transformers
huggingfaceOfficial
Train or fine-tune sentence-transformers models across `SentenceTransformer` (bi-encoder, dense or static embedding model for retrieval, similarity…
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
hf-cloud-sagemaker-iam-preflight
huggingfaceOfficial
Ensure a usable SageMaker execution role exists before deploying or training.
SkillBFreshness: B★ 11.2KClaude Code +9
Cite this page
huggingface-spaces skill. Agent Mart. https://agentmart.dev/skills/huggingface-huggingface-spaces (last updated 2026-10-24)