- title
- My Application
- emoji
- 🤗
- colorFrom
- blue
- colorTo
- purple
- sdk
- gradio # gradio, docker, or static
- sdk_version
- 5.0.0
- python_version
- 3.10
- app_file
- app.py
- app_port
- 7860 # Docker only
- suggested_hardware
- t4-small # or cpu-basic, a10g-small, etc.
- pinned
- true
- models
- datasets
- hf_oauth
- true # Enable HF OAuth
- preload_from_hub
**Hardware options:**
* CPU: `cpu-basic`, `cpu-upgrade`
* GPU: `t4-small`, `t4-medium`, `l4x1`, `l4x4`, `a10g-small`, `a10g-large`, `a100-large`
* TPU: `v5e-1x1`, `v5e-2x2`, `v5e-2x4`
### Model Card Metadata
language: - en license: apache-2.0 library_name: transformers pipeline_tag: text-classification tags: - nlp - sentiment datasets: - stanfordnlp/imdb base_model: bert-base-uncased metrics: - accuracy
## Resources
Detailed documentation organized by topic:
### references/
* `api-http.md` - **curl/HTTP API examples** for all endpoints
* `python-sdk.md` - huggingface\_hub Python patterns (download, upload, HfApi)
* `javascript-sdk.md` - @huggingface/hub and Transformers.js
* `inference-providers.md` - InferenceClient and provider selection
* `models-advanced.md` - **GGUF, PEFT/LoRA, quantization** formats
* `datasets-workflows.md` - **pandas, Polars, DuckDB** data workflows
* `spaces-config.md` - Complete YAML configuration reference
* `spaces-gradio.md` - Building Gradio Spaces
* `spaces-docker.md` - Docker Spaces with secrets and permissions
* `spaces-integration.md` - **Embedding, OAuth, MCP servers**
* `automation.md` - **Webhooks, Jobs, GitHub Actions**
* `security.md` - **Tokens, gating, scanning, SSO**
* `models.md` - Model repositories, cards, and uploading
* `datasets.md` - Dataset repositories and configuration
* `enterprise.md` - Enterprise Hub features
* `doc-syntax.md` - Doc-builder markdown syntax
### examples/
* `inference-curl.sh` - **Complete curl examples** for all APIs
* `jupyter-pandas.py` - **Jupyter + pandas workflow**
* `browser-transformersjs.html` - **Browser inference** with Transformers.js
* `lora-peft-workflow.py` - **LoRA adapter** find/load/merge workflow
* `webhooks-auto-retrain.py` - **Webhook automation** for retraining
* `collections-api.py` - **Collections** creation and management
* `offline-setup.py` - **Offline/air-gapped** environment setup
* `space-embed-iframe.html` - **Embedding patterns** for websites
* `gradio-image-classifier.py` - Image classification with gr.Interface
* `gradio-chat-interface.py` - Chat interface with HF model
* `upload-model.py` - PyTorchModelHubMixin complete example
* `download-files.py` - Various download patterns
* `model-card.md` - Model card template with metadata
* `dataset-card.md` - Dataset card template with metadata
### patterns/
* `missing-features.md` - **iOS, Next.js, full offline** workarounds
## Best Practices
1. **Always use environment variables for tokens** - Never hardcode `hf_xxx` tokens
2. **Use `.safetensors` format** - Preferred over `.bin` for model weights
3. **Add comprehensive model cards** - Include intended use, limitations, training data
4. **Pin SDK versions in Spaces** - Ensure reproducibility
5. **Use `preload_from_hub`** - Speed up Space startup by preloading models
6. **Set appropriate hardware** - Match compute needs to avoid OOM errors
7. **Use fine-grained tokens** - Minimize scope for production apps
8. **Use Parquet for datasets** - Much faster than CSV for large data