C.W.K.
Stream
Lesson 01 of 04 · published

What Spaces Actually Are

~22 min · spaces, deploy

Level 0Scout
0 XP0/50 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

A Space is a Git repo that runs an app

Behind the URL huggingface.co/spaces/{org}/{name} is a Git-backed repository with one file that matters: a manifest declaring the SDK (gradio, streamlit, docker, or static). Push to the repo, and HF builds and runs the app on managed hardware. Free CPU tier; paid GPU tiers up to A100 / H100.

Three SDK families

  • Gradio — component-first Python UI. Easiest path for ML demos. Auto-generates an inputs/outputs UI from a Python function signature.
  • Streamlit — script-first Python UI. Better for dashboards and richer state. Slightly more code than Gradio for the same demo.
  • Docker — arbitrary container. Anything you can put in a Dockerfile. Required for non-Python apps, custom Nginx, custom GPU drivers, FastAPI servers.
  • Static — HTML / CSS / JS hosted, no runtime. Good for documentation, landing pages, model showcases.

What Spaces are not

Not a general PaaS. Not a database backend (no persistent disk on free tier; persistent storage on paid tiers is limited). Not a long-running task queue. Spaces is for "one app, often a model demo, served from the Hub" — great for that, weak for everything else.

Code

Minimum Space manifest (README.md front-matter)·yaml
---
title: My HF Demo
emoji: 🤗
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: apache-2.0
---

# My HF Demo

The README body is rendered above the running app on the Space page.
Create a Space programmatically·python
from huggingface_hub import HfApi

api = HfApi()
api.create_repo(
    repo_id="yourname/my-demo",
    repo_type="space",
    space_sdk="gradio",
    private=True,
)
api.upload_file(
    path_or_fileobj="app.py",
    path_in_repo="app.py",
    repo_id="yourname/my-demo",
    repo_type="space",
)

External links

Exercise

Create a Gradio Space (private) via the Hub UI, push a 'hello world' app.py, watch it build and serve. Then duplicate the same demo as a Docker Space (FastAPI behind a basic Dockerfile). Compare: build time, cold-start time, debug experience.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.