huggingface spaces
**Hugging Face Spaces** is a **platform for hosting and sharing interactive machine learning demos and applications** — supporting Gradio (auto-generated UI from Python functions), Streamlit (data dashboards), and Docker (any custom application), with free CPU hosting and paid GPU tiers (A10G at $1.05/hr, A100 at $4.13/hr), making it the easiest way to turn any trained ML model into a publicly accessible, interactive web application that anyone can try without installation.
**What Is Hugging Face Spaces?**
- **Definition**: A hosting platform (huggingface.co/spaces) that deploys ML applications from a Git repository — automatically detecting the framework (Gradio, Streamlit, or Docker), building the environment, and serving the application at a public URL.
- **The Problem**: You trained a great model. Now what? Sharing a .pkl file or a Colab notebook isn't useful for non-technical stakeholders. They need to click a button, upload an image, and see the result.
- **The Solution**: Spaces provides free hosting for interactive demos. Write a 10-line Gradio app, push to Spaces, and share a URL. Your manager, client, or the world can interact with your model instantly.
**Supported Frameworks**
| Framework | Use Case | Code Required | Example |
|-----------|---------|---------------|---------|
| **Gradio** | Quick ML demos with auto-generated UI | ~10 lines | Image classifier, text generator, chatbot |
| **Streamlit** | Data dashboards and interactive apps | ~30 lines | Data exploration, analytics dashboards |
| **Docker** | Any custom application | Dockerfile | FastAPI, Next.js, custom web apps |
| **Static HTML** | Simple static pages | HTML files | Documentation, portfolios |
**Hardware Tiers**
| Tier | Hardware | RAM | Cost | Use Case |
|------|---------|-----|------|----------|
| **Free** | 2 vCPU | 16GB | $0 | Small demos, starter projects |
| **CPU Upgrade** | 8 vCPU | 32GB | $0.03/hr | Larger CPU models |
| **T4 Small** | T4 GPU | 16GB | $0.60/hr | Medium GPU inference |
| **A10G Small** | A10G GPU | 24GB | $1.05/hr | Large model inference |
| **A100 Large** | A100 GPU | 80GB | $4.13/hr | LLM demos, Stable Diffusion |
**Gradio Example (10 lines)**
```python
import gradio as gr
from transformers import pipeline
classifier = pipeline("image-classification", model="google/vit-base-patch16-224")
def classify(image):
results = classifier(image)
return {r["label"]: r["score"] for r in results}
demo = gr.Interface(fn=classify, inputs="image", outputs="label")
demo.launch()
```
**Popular Spaces**
| Space | Model | Usage |
|-------|-------|-------|
| **Stable Diffusion** | Text-to-image generation | Millions of users |
| **ChatGPT-style demos** | Open-source LLMs (Llama, Mistral) | Interactive chat |
| **Whisper** | Speech-to-text | Audio transcription |
| **DALL-E Mini** | Text-to-image (viral in 2022) | Public demo |
**Hugging Face Spaces is the standard platform for sharing ML demos** — providing free hosting for Gradio, Streamlit, and Docker applications with optional GPU hardware, enabling anyone to turn a trained model into an interactive web application accessible via a public URL in minutes.