Spaces:
Running
Running
A newer version of the Gradio SDK is available: 6.20.0
Project Instructions
Python Environment
- Always use
uvto run Python scripts and manage dependencies — never usepiporpythondirectly - Run scripts with
uv run python script.pyinstead ofpython script.py - Install packages with
uv add package-nameinstead ofpip install - To run one-off commands:
uv run <command> - The project uses
uvfor virtual environment management; do not create venvs manually withpython -m venv
Common Commands
uv run python script.py— run a scriptuv add <package>— add a dependencyuv sync— install all dependencies from lockfileuv run pytest— run tests
Dependencies
- After any
uv add/uv remove, regenerate the Hugging Face requirements file or the deploy will not get the change — the Space installs fromrequirements.txt, not fromuv.lock:uv export --format requirements.txt --no-hashes --no-dev --frozen --output-file requirements.txt - Commit
pyproject.toml,uv.lock, andrequirements.txttogether when dependencies change.
Rendering Constraints (Hugging Face)
- Hugging Face Spaces run headless with no GPU/WebGL and no guaranteed
ffmpeg. - For any server-side image or animation rendering, use CPU-only paths: Matplotlib's
Aggbackend, GIF via Pillow. - Avoid
kaleido/ Plotly static-image export (3D is extremely slow headless) and ffmpeg-dependent MP4 output. Both were tried and proved unreliable here; the parallel-print GIF export uses MatplotlibAgginstead.
Local Tooling
.claude/(e.g.launch.jsonfor the local preview server) is gitignored and not deployed.
Hugging Face Deployment
.stlfiles must be tracked by Git LFS (*.stl filter=lfsin.gitattributes)- Verify Git LFS is available before push:
git lfs version - Confirm tracked LFS files:
git lfs ls-files - Standard push sequence:
git push origin mainthengit push hf-space main - If Hugging Face rejects binaries, re-check
.gitattributesand LFS status before retrying git lfs migraterewrites history; only use it intentionally and coordinate with collaborators first