Spaces:
Paused
Paused
Upload 4 files
Browse files- README.md +53 -5
- app.py +47 -0
- packages.txt +6 -0
- requirements.txt +24 -0
README.md
CHANGED
|
@@ -1,10 +1,58 @@
|
|
| 1 |
---
|
| 2 |
title: VideoTimeTravel
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk:
|
|
|
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: VideoTimeTravel
|
| 3 |
+
emoji: 🕰️
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
app_file: app.py
|
| 8 |
pinned: false
|
| 9 |
+
license: mit
|
| 10 |
+
short_description: Re-age faces in video - younger or older, kept consistent.
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# VideoTimeTravel
|
| 14 |
+
|
| 15 |
+
Temporally consistent face re-aging in video, using diffusion-based
|
| 16 |
+
editing and optical flow warping. Make people look younger or older in a
|
| 17 |
+
video while preserving identity and coherence across frames.
|
| 18 |
+
|
| 19 |
+
This is an implementation of the paper *"VideoTimeTravel: High-Fidelity
|
| 20 |
+
Face Re-Aging Diffusion Models for Production Video"* (Kim, Nam, Seo -
|
| 21 |
+
The Visual Computer, 2026), by Aaryn Biro. The same pipeline is a
|
| 22 |
+
feature of PixelSpark and runs standalone as the `video-time-travel`
|
| 23 |
+
project.
|
| 24 |
+
|
| 25 |
+
## How it works
|
| 26 |
+
|
| 27 |
+
1. **Keyframe selection** - fixed intervals plus scene boundaries
|
| 28 |
+
2. **Age estimation** - MiVOLO estimates source age and gender
|
| 29 |
+
automatically (overridable in the UI)
|
| 30 |
+
3. **DDIM inversion** of every keyframe
|
| 31 |
+
4. **Joint null-text optimization** - one shared embedding across all
|
| 32 |
+
keyframes, for global consistency
|
| 33 |
+
5. **Keyframe editing** - FADING (diffusion, paper quality) or FRAN
|
| 34 |
+
(single forward pass, faster and subtler), via Prompt-to-Prompt
|
| 35 |
+
6. **Delta extraction** - only the age-related change is kept
|
| 36 |
+
7. **Flow propagation** - GMFlow warps the deltas to the frames between
|
| 37 |
+
keyframes, blended bidirectionally
|
| 38 |
+
|
| 39 |
+
## Using the demo
|
| 40 |
+
|
| 41 |
+
- Short clips only (under 60 seconds). Processing at 512x512 with 50
|
| 42 |
+
DDIM steps takes minutes on a GPU - this Space needs ZeroGPU
|
| 43 |
+
hardware; it cannot run on CPU.
|
| 44 |
+
- Pick a **target age**, or **shift by years** (negative makes the
|
| 45 |
+
subject younger).
|
| 46 |
+
- FADING is the paper method and the best quality. FRAN is much faster
|
| 47 |
+
per keyframe with a subtler effect.
|
| 48 |
+
|
| 49 |
+
## Credits and license
|
| 50 |
+
|
| 51 |
+
- Paper: Kim, Nam, Seo - VideoTimeTravel (The Visual Computer, 2026)
|
| 52 |
+
- Built on: FADING (Chen et al.), GMFlow (Xu et al., CVPR 2022),
|
| 53 |
+
MiVOLO (Kuprashevich and Tolstykh), and the open FRAN replication by
|
| 54 |
+
timroelofs123 (itself after Disney Research's FRAN paper)
|
| 55 |
+
- This implementation: MIT license. Model weights are downloaded at
|
| 56 |
+
first run from a separate model repo and keep their own licenses.
|
| 57 |
+
|
| 58 |
+
By Aaryn Biro - [github.com/aabiro/video-time-travel](https://github.com/aabiro/video-time-travel)
|
app.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Thin public loader for this Space.
|
| 2 |
+
|
| 3 |
+
The real application code for this Space is not public. It lives in a
|
| 4 |
+
private Hugging Face repo and is downloaded at startup using this
|
| 5 |
+
Space's HF_TOKEN secret. Only this loader file is public.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import os
|
| 9 |
+
import sys
|
| 10 |
+
import zipfile
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
PAYLOAD_REPO = "aabiro/space-payloads"
|
| 14 |
+
PAYLOAD_FILE = "video-time-travel.zip"
|
| 15 |
+
TARGET = Path("/tmp/space-app/video-time-travel")
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def _fetch_payload() -> None:
|
| 19 |
+
if (TARGET / "app.py").is_file():
|
| 20 |
+
return
|
| 21 |
+
token = os.environ.get("HF_TOKEN")
|
| 22 |
+
if not token:
|
| 23 |
+
raise RuntimeError(
|
| 24 |
+
"HF_TOKEN secret is not set on this Space, so the private "
|
| 25 |
+
"application code cannot be downloaded."
|
| 26 |
+
)
|
| 27 |
+
from huggingface_hub import hf_hub_download
|
| 28 |
+
|
| 29 |
+
zip_path = hf_hub_download(
|
| 30 |
+
repo_id=PAYLOAD_REPO,
|
| 31 |
+
repo_type="model",
|
| 32 |
+
filename=PAYLOAD_FILE,
|
| 33 |
+
token=token,
|
| 34 |
+
)
|
| 35 |
+
TARGET.mkdir(parents=True, exist_ok=True)
|
| 36 |
+
with zipfile.ZipFile(zip_path) as zf:
|
| 37 |
+
zf.extractall(TARGET)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
_fetch_payload()
|
| 41 |
+
sys.path.insert(0, str(TARGET))
|
| 42 |
+
os.chdir(TARGET)
|
| 43 |
+
_app_file = TARGET / "app.py"
|
| 44 |
+
exec(
|
| 45 |
+
compile(_app_file.read_text(encoding="utf-8"), str(_app_file), "exec"),
|
| 46 |
+
{"__name__": "__main__", "__file__": str(_app_file)},
|
| 47 |
+
)
|
packages.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ffmpeg
|
| 2 |
+
cmake
|
| 3 |
+
build-essential
|
| 4 |
+
libgl1
|
| 5 |
+
libglib2.0-0
|
| 6 |
+
libgomp1
|
requirements.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--extra-index-url https://download.pytorch.org/whl/cu121
|
| 2 |
+
gradio
|
| 3 |
+
spaces
|
| 4 |
+
huggingface_hub
|
| 5 |
+
torch==2.5.1
|
| 6 |
+
torchvision==0.20.1
|
| 7 |
+
numpy==2.3.5
|
| 8 |
+
scipy>=1.14
|
| 9 |
+
opencv-python==4.13.0.90
|
| 10 |
+
pillow>=10.0.0
|
| 11 |
+
decord==0.6.0
|
| 12 |
+
scenedetect==0.6.7.1
|
| 13 |
+
diffusers==0.36.0
|
| 14 |
+
transformers==5.0.0
|
| 15 |
+
accelerate==1.12.0
|
| 16 |
+
dlib==20.0.0
|
| 17 |
+
insightface==0.7.3
|
| 18 |
+
onnxruntime-gpu==1.24.4
|
| 19 |
+
ultralytics==8.1.0
|
| 20 |
+
timm>=0.9
|
| 21 |
+
omegaconf==2.3.0
|
| 22 |
+
ffmpeg-python>=0.2.0
|
| 23 |
+
ipython>=8.0
|
| 24 |
+
tqdm>=4.66.0
|