ghostscientist/skills · Archived

hugging-face-space-deployer

Use this skill when deploying a machine learning model to a Hugging Face Space, creating an interactive ML demo, or publishing a model with a web UI. Covers Gradio and Streamlit apps, chat and image-generation interfaces, LoRA/PEFT adapters, ZeroGPU and paid GPU hardware, and managing existing Spaces. Use it whenever the user mentions Hugging Face Spaces, wants to "put a model online", "make a demo for my model", "share my fine-tune", or deploy a model they just trained — even if they don't say…

First seen Jan 28, 2026

Installation

$ npx skills add ghostscientist/skills --skill hugging-face-space-deployer

Summary

  • Use this skill when deploying a machine learning model to a Hugging Face Space, creating an interactive ML demo, or publishing a model with a web UI.
  • Covers Gradio and Streamlit apps, chat and image-generation interfaces, LoRA/PEFT adapters, ZeroGPU and paid GPU hardware, and managing existing Spaces.
  • Use it whenever the user mentions Hugging Face Spaces, wants to "put a model online", "make a demo for my model", "share my fine-tune", or deploy a model they just trained — even if they don't say "Space" or "Gradio" explicitly.

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from ghostscientist/skills · top by installs.

npx skills add ghostscientist/skills

Browse all from ghostscientist/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 3
License LICENSE
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.1
LicenseApache-2.0
More metadata
author
GhostScientist
version
1.1

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,847 B
  • docs SUMMARY.md 568 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 3 installs

SKILL.md

Hugging Face Space Deployer

Create, configure, and deploy interactive ML demos on Hugging Face Spaces.

Deployment fails in predictable ways when the model's type is misidentified. Always analyze the model before generating any code.

Workflow

  1. Analyze the model — full model, LoRA adapter, or Inference API supported.
  2. Choose a deployment strategy from that analysis.
  3. Ask the user if the model type or cost preference is unclear.
  4. Deploy with scripts/deploy_model.py, or assemble the Space manually.
  5. Set the runtime hardware in Space Settings.
  6. Verify the Space builds and actually answers a request.

Step 1: Analyze the model

Inspect the model's files on the Hub before anything else:

hf download username/model-name --local-dir /tmp/check --dry-run 2>&1 | grep -E '\.(safetensors|bin|json)'
Does it have adapter_config.json?
├── YES → LoRA adapter. Read base_model_name_or_path from that file.
│         Deploy with peft + ZeroGPU.
└── NO
    ├── Has model.safetensors / pytorch_model.bin?
    │   ├── Inference widget on the model page? → Inference API, cpu-basic
    │   └── No widget?                          → ZeroGPU, load with transformers
    └── Neither → incomplete upload. Ask the user.

Read references/model-analysis.md for the full file-to-type table, Inference API detection signals, the hardware tier table, and how to fix a missing pipeline_tag.

Adapters never have direct Inference API support. If you find adapter_config.json, the Inference API path is ruled out — do not attempt it.

Step 2: Deploy

scripts/deploy_model.py performs the analysis in Step 1 automatically and picks the strategy, hardware, and dependencies. Prefer it:

# Full model or Inference API model — strategy auto-detected
python scripts/deploy_model.py meta-llama/Llama-3-8B-Instruct --type chat

# LoRA adapter — base model read from adapter_config.json
python scripts/deploy_model.py username/my-lora-adapter --type chat

# Override the auto-detected base model
python scripts/deploy_model.py username/my-lora --type chat --base-model Qwen/Qwen2.5-Coder-1.5B-Instruct

--type is required and accepts chat, image-classification, text-to-image, text-generation, or embedding. Also available: --name, --hardware, --private, --org, and --force-zerogpu.

Requires huggingface_hub and an authenticated hf CLI (hf auth login).

To assemble a Space by hand instead — no network access to run the script, an unsupported model type, or the user asks to see the files — read references/manual-deployment.md. It maps each situation to the right starting files in assets/ and covers the placeholders to replace.

Step 3: Set hardware

GPU templates do not work until hardware is set manually. Go to https://huggingface.co/spaces/USERNAME/SPACENAME/settings → "Space Hardware" and select ZeroGPU (free, on-demand) or a paid tier. suggestedhardware in the README is only a hint.

This single step causes the most post-deploy failures, including the common "No API found" error.

Step 4: Verify

Watch the build logs, then send one real request. A Space can build cleanly and still fail at inference — a wrong LoRA base model produces garbage output rather than an error.

If anything fails, read references/troubleshooting.md.

Managing existing Spaces

scripts/manage_space.py handles hardware changes, secrets, and lifecycle:

python scripts/manage_space.py status username/my-space
python scripts/manage_space.py hardware username/my-space --tier t4-small
python scripts/manage_space.py secret username/my-space --key API_KEY --value xxx
python scripts/manage_space.py pause username/my-space      # stops billing
python scripts/manage_space.py restart username/my-space

scripts/create_space.py creates an empty, correctly-scaffolded Space when you want to upload files separately.

Gotchas

  • Use gradio>=5.0.0 and huggingface_hub>=0.26.0. Do not pin Gradio to an old exact patch

version — gradio==4.44.0 raises ImportError: cannot import name 'HfFolder'.

  • Gradio 5.x requires nested lists for examples: [["ex1"], ["ex2"]], not ["ex1", "ex2"].
  • LoRA Spaces must include peft in requirements.txt.
  • Keep sdk_version in the README frontmatter consistent with the gradio version in

requirements.txt.

rather than quoting rates.

Bundled files

Path Contents
scripts/deploy_model.py Auto-detecting end-to-end deployment (preferred path)
scripts/create_space.py Create a scaffolded, empty Space
scripts/manage_space.py Hardware, secrets, pause/restart for existing Spaces
references/model-analysis.md Model type detection, Inference API signals, hardware tiers
references/manual-deployment.md Hand-assembly walkthrough and template selection
references/troubleshooting.md Build and runtime error fixes
assets/ Gradio/Streamlit app templates, requirements files, README templates