Fix: Hugging Face Space Not Showing Under “Spaces using this model”

TL;DR: Hugging Face links Spaces to models by statically parsing repo files (README front-matter or certain file types) for literal model IDs. If your IDs only live in a YAML config or are built dynamically in code, your Space won’t appear on the model card. Add the model IDs to your Space README (or any parsed file) and it’s fixed.


I ran into a confusing issue: my Space loaded three public models just fine at runtime (downloaded from the Hub, worked in the app), but the models’ pages didn’t show my Space under “Spaces using this model.”

What I tried (and didn’t help):

  • Rebuilding the Space from scratch

  • Clearing caches

  • Moving load code around (top-level vs. inside functions, with/without @spaces.GPU)

  • Waiting for re-indexing

Root cause: The Hub doesn’t discover usage from runtime logs or dynamic strings. It parses repository files for plain text identifiers like org/model. My model names lived only in a YAML config and dynamic code paths—so indexing never saw them.

The fix: Add your models explicitly to the Space README front-matter:

---
title: Kani TTS Demo
sdk: gradio
app_file: app.py
pinned: false
models:
  - nineninesix/kani-tts-370m
  - nineninesix/kani-tts-450m-0.2-pt
  - nineninesix/kani-tts-450m-0.1-pt
---

Alternatively, drop a tiny .py file with literal strings (the file doesn’t need to be used at runtime):

# link_models.py
_ = [
  "org/model-a",
  "org/model-b",
]

Why this works: README metadata and files like .py, .ini, .html are scanned; YAML configs and dynamically built strings aren’t guaranteed to be. After committing, the model cards immediately showed my Space under “Spaces using this model.”

Quick checklist

  • Put literal model IDs in README models: or in a parsed file (.py/.ini/.html)

  • Commit → build → refresh model pages

  • Done :white_check_mark:

Models involved in my case:
nineninesix/kani-tts-370m, nineninesix/kani-tts-450m-0.2-pt, nineninesix/kani-tts-450m-0.1-pt

1 Like