vector / docs /hugging-face-spaces.md
d-ragon's picture
Upload 547 files
851e5ba verified
|
Raw History Blame Contribute Delete
9.18 kB

Hugging Face Docker Space

This deployment runs SupoClip in one Linux container on CPU Basic. You do not need Docker or WSL on your own computer to upload this checkout. Hugging Face must permit Docker Spaces on your account; hardware availability, sleep rules, and account entitlements are controlled by Hugging Face.

1. Create The Space And Add Secrets

Create a Space with the Docker SDK and CPU Basic hardware. Prefer a private Space. The app also disables signup and provisions only your owner account, even when the Space itself is public.

Before the first successful startup, add these in Settings > Variables and secrets > New secret:

Secret Value
HF_ADMIN_EMAIL The email address you will use to sign in
HF_ADMIN_PASSWORD A unique, nonblank password, 12 to 128 characters
NVIDIA_API_KEY Your own NVIDIA API key for MiniMax selection

The first two are required to start. The NVIDIA key can alternatively be entered after sign-in on /admin; generation requires it. Keeping it in Space Secrets means it is available again after the temporary database is lost.

Do not place secrets in the Space's files, README, public Variables, or build arguments. The launcher creates independent signing, database, Redis, and settings-encryption secrets at runtime. Those values are shared correctly between processes and reused while that local data still exists.

SPACE_HOST normally supplies the public hostname. If it is unavailable, add a public Variable HF_PUBLIC_URL=https://your-space-host.hf.space. Use the exact direct app URL shown by Hugging Face, not the huggingface.co/spaces/... page. For correct generated canonical URLs as well, set NEXT_PUBLIC_APP_URL to that same HTTPS URL before building. This latter value is not a secret.

2. Upload The Source Files

Upload the contents of the repository root, so Dockerfile and README.md are at the root of the Space, not inside another supoclip-main directory.

The build needs:

  • Root Dockerfile, .dockerignore, README.md, CHANGELOG.md, LICENSE, init.sql.
  • deploy/huggingface/.
  • backend/pyproject.toml, backend/uv.lock, backend/src/, backend/fonts/, backend/transitions/.
  • Frontend source, public assets, messages, Prisma schema, scripts, config files, package.json, and pnpm-lock.yaml.

Do not upload local dependency or secret directories: node_modules, .next, .venv, .env files, logs, temporary videos, test recordings, or credentials. Docker ignores these during its build, but .dockerignore does not prevent you from accidentally uploading them to the Space repository first.

The root README already declares sdk: docker and port 7860. Hugging Face builds the image remotely. The first build includes CPU PyTorch, FFmpeg, OCR, and fonts and is not a tiny download. No CUDA image, GPU driver, or local LLM is used.

3. Sign In And Generate Clips

Once the Space is running, open its direct https://...hf.space URL in a normal browser tab. If login fails inside the Hugging Face iframe, use the direct URL; secure session cookies may be restricted in a cross-site iframe.

Open /sign-in and use HF_ADMIN_EMAIL / HF_ADMIN_PASSWORD. Do not sign up: signup is intentionally disabled. The owner is created before the public proxy starts. Existing unmarked accounts are never silently promoted to admin.

On /admin, check the NVIDIA API key and model settings. The default is:

LLM=nvidia:minimaxai/minimax-m3.1-flash

The reranker inherits that model unless RERANK_LLM is explicitly set. Use Prefer saved when an Admin value should override a deployment environment setting. Changing providers does not reprocess finished/cached tasks.

Upload a video to avoid possible YouTube datacenter-IP restrictions. YouTube downloads can be blocked or rate-limited independently of the app or NVIDIA. No proxy/cookie bypass is configured by this deployment.

Transcription And Performance

The default is local CPU Whisper small, including in fast mode. This requires no additional transcription API key. Its weights download on first use and may download again after a rebuild. A two-hour video can take a long time on two CPU cores; this is not a real-time-performance promise.

To use the already-supported hosted transcription instead, set the Variable TRANSCRIPTION_PROVIDER=assemblyai and Secret ASSEMBLY_AI_API_KEY. Provider pricing and quotas apply. A Groq transcription adapter has not been added here.

One ARQ job runs at a time. A shared, process-wide FFmpeg lock prevents a manual export and a queued render from encoding concurrently. FFmpeg decoder, encoder, and filter thread settings are capped at one by default. These are CPU resource limits, not changes to the highlight-selection prompts or caption presets.

The input-duration limit is three hours, and the application upload limit is 4,000,000,000 bytes. Hugging Face's upstream request limits still apply. Prefer smaller files for a first test. AI-editor instructions that require a separate Claude/Ollama editor worker, social publishing, and extra workers are not started by this lightweight deployment; the core clipping and manual editor remain the focus.

Temporary Storage

PostgreSQL, Redis, media and processing caches use local disk under /home/user/runtime, not RAM-only storage. The running services use RAM as well. RAM does not make files durable.

When Hugging Face discards that filesystem, the following are lost:

  • Account changes, sessions, and settings saved only inside the app.
  • Uploaded videos, generated clips, task records, and pending jobs.

Space Secrets are managed separately by Hugging Face and can provision the owner again. The owner-password Secret is used only for a new database; it does not silently reset an existing user's password. The recorded owner's identity and admin status must stay consistent, or startup fails closed.

Inactivity sleep, a 48-hour policy, and a storage guarantee are different things. Restarts, rebuilds, and failures can discard local data sooner. Download finished clips promptly. This deployment never deletes an existing database merely to make startup succeed.

Optional Storage Buckets

Hugging Face supports attaching buckets to Spaces as read-write volumes, and its current storage-limits documentation lists a 100 GB private-storage allowance for free accounts, shared across repository types. Verify your own remaining allowance and billing settings before storing large videos; this is not a promise of unlimited free storage or Docker-Space entitlement.

Buckets are a good fit for finished clips, original-file archives, and completed database backup files. Create a private bucket and, if attaching it, use a separate path such as /data/archive. Do not mount it over /app, /home/user/runtime, PostgreSQL's data directory, or the live render workspace.

The documented hf-mount layer is eventually consistent. Its default streaming mode buffers writes until close, and advanced writes use local staging with asynchronous flush. It explicitly is not a general-purpose strongly consistent filesystem. A mount that looks like a directory is therefore not a safe assumption for PostgreSQL's live database files or unfinished MP4 output.

Attaching a bucket alone does not make this app persistent. This deployment does not automatically copy clips, back up the database, or restore task history from a bucket. For now, download clips and upload the files you want to retain to your private bucket. A future automatic archive/restore flow must handle completed files, database snapshots, authentication secrets, and recovery together; preserving only an MP4 does not preserve its task/account records.

Official references:

Startup And Validation

Startup initializes local PostgreSQL once, applies the base schema and backend migrations, starts Redis, provisions the owner, starts the worker/frontend, and only then exposes nginx on port 7860. Internal services bind to loopback. Every browser API request stays behind Next's session-to-signed-backend authentication bridge. A critical service exit shuts down the instance rather than leaving a partially working app publicly available.

Use the Space build/runtime logs to identify the failed stage. Missing owner Secrets and invalid public URLs fail before public access. Do not remove data or disable authentication to bypass an initialization error.

The packaging has unit/static checks, but a successful Docker build, PostgreSQL startup, NVIDIA call, and end-to-end video export still need validation in your Space. No remote deployment or local Docker installation is performed by adding these files.