Downloads · 30 days
0
zaruta/freemorph-mvp
freemorph-mvp is a machine learning model from zaruta. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Single-page FastAPI app that wraps the FreeMorph diffusion pipeline alongside the IMPUS perceptually-uniform morphing method into a simple UI. Upload two square-ish images, optionally describe them, pick the backend,…
Downloads · 30 days
0
Access
Public
Updated Nov 17, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py70.1 KB · 81%
From the Hugging Face model README
Single-page FastAPI app that wraps the FreeMorph diffusion pipeline alongside the IMPUS perceptually-uniform morphing method into a simple UI. Upload two square-ish images, optionally describe them, pick the backend, and receive the interpolated frames rendered by Stable Diffusion (2.1 for FreeMorph, 1.4+LoRA for IMPUS).
Heads up: Both pipelines are GPU hungry. FreeMorph prefers ≥12GB VRAM; IMPUS often needs 14GB+ plus long per-job fine-tuning runs.
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
The first run will download Stable Diffusion 2.1 weights as well as tokenizer / text encoder checkpoints into the local Hugging Face cache (~/.cache/huggingface).
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
Then open http://localhost:8000 and:
.jpg, .png, etc.). Square crops work best; non-square inputs are center-cropped internally.Results are written to storage/results/<job_id> and exposed via /storage/results/... URLs so they can be re-loaded or downloaded later. Original uploads are kept under storage/uploads/<job_id> for reproducibility.
Login & create repo
huggingface-cli login --token <your_hf_token>
huggingface-cli repo create zaruta/freemorph-mvp --type=model
git clone https://huggingface.co/zaruta/freemorph-mvp
cd freemorph-mvp
cp -R /Users/zaruta/morph-test/* .
git add .
git commit -m "Deploy FreeMorph"
git push
Build & push Docker image (linux/amd64)
cd /Users/zaruta/morph-test
docker login -u zaruta
docker buildx build --platform linux/amd64 -t zaruta/freemorph-mvp:latest --push .
Create endpoint
In https://ui.endpoints.huggingface.co/ → New Endpoint:
zaruta/freemorph-mvpdocker.io/zaruta/freemorph-mvp:latest8000/api/healthus-east-1After the build finishes the endpoint URL looks like https://nziq03no5bepo0w1.us-east-1.aws.endpoints.huggingface.cloud.
cd /Users/zaruta/morph-test
source .venv/bin/activate
export API_BASE_URL="https://nziq03no5bepo0w1.us-east-1.aws.endpoints.huggingface.cloud"
export HF_API_TOKEN="<your_hf_token_here>"
uvicorn app.main:app --host 0.0.0.0 --port 8000
http://localhost:8000./api/morph to the remote endpoint, attaching Authorization: Bearer <your_hf_token> when HF_API_TOKEN is set.https://nziq03no5bepo0w1.us-east-1.aws.endpoints.huggingface.cloud/storage/results/<job>/frame_00.png, so the UI renders images directly from HF storage (локально они не появляются).engine form field is forwarded to the remote endpoint, so hosted deployments expose the same FreeMorph/IMPUS toggle.engine form field.engine=freemorph, diffusion runs fully in-process via FreeMorphService.engine=impus, the app shells out to the vendored IMPUS reference script (vendor/IMPUS/run_morph.py), waits for it to dump numbered PNG frames, and renames them to the common frame_##.png format consumed by the UI.jobId, frames, frameCount, durationMs), so the UI and remote deployments stay agnostic.steps, guidance_scale, or interpolation_size in app/freemorph_service.py./storage/results/<job> around if you want to inspect the intermediate .pt checkpoints it emits.app/ – FastAPI entrypoint plus the FreeMorph/IMPUS service wrappersstatic/ & templates/ – MVP UI assetsstorage/uploads, storage/results – persisted inputs/outputsvendor/FreeMorph – untouched upstream FreeMorph implementationvendor/IMPUS – upstream IMPUS script + helpers invoked via subprocessThe repo already contains a production-ready Dockerfile. To run FreeMorph on a hosted GPU:
Dockerfile must live in the root).Custom Docker, select GPU hardware (A10G works well), and point the endpoint at your repo.pip install -r requirements.txt and start FastAPI via uvicorn app.main:app --host 0.0.0.0 --port 8000.https://<endpoint>/api/morph; reuse the same JSON contract as locally.Stop/pause the endpoint when you are not testing to avoid GPU charges.