ReShot — copy the shot, not the actors. Video → depth map, OpenPose skeleton or canny lines for Seedance 2.0/2.5 reference video, MiniMax H3 Fun ControlNet and Wan VACE. Apache-2.0. Open-sourced by Maosika 猫斯卡 (www.maosika.com), the AI short-drama production system.
Python ai-short-dramaai-videocannycomfyuicontrolnetdepth-anythingdepth-estimationdwposemaosikaminimaxopenposepose-controlnetpose-estimationseedanceshort-dramavideo-generationvideo-to-videowan
0.4.1: ZeroGPU Space (demo/space), run(backend=) for resident processes, landing page links to it
wangfeng062c585f7649
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 20b5b22..2a9631b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,13 @@# Changelog+## 0.4.1 — 2026-09-14+- **Hugging Face Space that runs.** [huggingface.co/spaces/netbee/reshot](https://huggingface.co/spaces/netbee/reshot)+ on ZeroGPU: drop a clip up to 15 s, pick the target model, get `depth.mp4` and the prompt line+ back — no install. Source in `demo/space/`.+- `run(cfg, backend=...)` accepts a pre-built backend, so a resident process (the Space, a server)+ loads the weights once instead of per clip. Without it nothing changes.+- Discussions are open; the README has a Community section.+## 0.4.0 — 2026-09-12- **Web page.** `reshot` with no arguments (or `reshot web`) starts a local UI in the browser:drop a clip, pick the target model and quality, run, preview reference and depth side bydiff --git a/README.md b/README.mdindex 8bf3e50..9e9755b 100644--- a/README.md+++ b/README.md@@ -5,7 +5,7 @@<p align="center"><img src="docs/demo-fight.gif" width="720" alt="a fight scene, its depth map, and three new takes generated from it"></p><p align="center"><sub>Top: the reference and its depth map. Bottom: three takes generated from that depth map — two women, one rabbit. Same moves, same camera. <a href="docs/demo-fight.mp4">Full-resolution clip</a>.</sub></p>-<p align="center"><a href="README.zh-CN.md">中文</a> · <a href="docs/USAGE.md">User guide</a> · <a href="https://github.com/maosika-ai/ComfyUI-ReShot">ComfyUI nodes</a> · <a href="https://huggingface.co/spaces/maosika/reshot">Hugging Face</a> · <a href="https://github.com/maosika-ai/reshot/discussions">Community</a> · <a href="CHANGELOG.md">Changelog</a></p>+<p align="center"><a href="README.zh-CN.md">中文</a> · <a href="docs/USAGE.md">User guide</a> · <a href="https://github.com/maosika-ai/ComfyUI-ReShot">ComfyUI nodes</a> · <a href="https://huggingface.co/spaces/netbee/reshot">Try it online</a> · <a href="https://github.com/maosika-ai/reshot/discussions">Community</a> · <a href="CHANGELOG.md">Changelog</a></p><p align="center"><a href="https://github.com/maosika-ai/reshot/actions/workflows/ci.yml"><img src="https://github.com/maosika-ai/reshot/actions/workflows/ci.yml/badge.svg" alt="ci"></a><a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="Apache-2.0"></a>@@ -37,6 +37,8 @@ The three takes in the demo were made exactly this way. Every file involved is i### 1. Install+**No install:** [try it in the browser](https://huggingface.co/spaces/netbee/reshot) on a free GPU — clips up to 15 s, about 30 seconds each.+```bashpip install reshot # needs ffmpeg on PATH```diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 8571c18..f5dfd5a 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -5,7 +5,7 @@<p align="center"><img src="docs/demo-fight.gif" width="720" alt="一段武打参考片、它的深度图、用深度图生成的三段新武打片"></p><p align="center"><sub>上排:参考片和它的深度图。下排:用这张深度图生成的三段片——两个女人、一只兔子。动作一样,镜头一样。<a href="docs/demo-fight.mp4">高清原片</a>。</sub></p>-<p align="center"><a href="README.md">English</a> · <a href="docs/USAGE.zh-CN.md">使用手册</a> · <a href="https://github.com/maosika-ai/ComfyUI-ReShot">ComfyUI 节点</a> · <a href="https://huggingface.co/spaces/maosika/reshot">Hugging Face</a> · <a href="https://github.com/maosika-ai/reshot/discussions">社区</a> · <a href="CHANGELOG.md">更新日志</a></p>+<p align="center"><a href="README.md">English</a> · <a href="docs/USAGE.zh-CN.md">使用手册</a> · <a href="https://github.com/maosika-ai/ComfyUI-ReShot">ComfyUI 节点</a> · <a href="https://huggingface.co/spaces/netbee/reshot">在线试用</a> · <a href="https://github.com/maosika-ai/reshot/discussions">社区</a> · <a href="CHANGELOG.md">更新日志</a></p><p align="center"><a href="https://github.com/maosika-ai/reshot/actions/workflows/ci.yml"><img src="https://github.com/maosika-ai/reshot/actions/workflows/ci.yml/badge.svg" alt="ci"></a><a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="Apache-2.0"></a>@@ -37,6 +37,8 @@ ReShot 吃进一个 `.mp4`,吐出一个 `.mp4`。输出是一段**深度图视### 1. 装+**不想装:**[在浏览器里直接试](https://huggingface.co/spaces/netbee/reshot),免费 GPU,15 秒以内的片,一段约 30 秒。+```bashpip install reshot # 需要 PATH 里有 ffmpeg```diff --git a/demo/landing/README.md b/demo/landing/README.mdnew file mode 100644index 0000000..3636b7c--- /dev/null+++ b/demo/landing/README.md@@ -0,0 +1,26 @@+---+title: ReShot+emoji: 🎬+colorFrom: gray+colorTo: yellow+sdk: static+pinned: false+license: apache-2.0+short_description: Copy the shot, not the actors. By Maosika 猫斯卡.+---++# ReShot++Copy the shot, not the actors. ReShot turns any reference video into a depth map — the+control signal that lets a video model copy a shot's **staging and camera** without copying+its faces, wardrobe or style.++- Presets for Seedance 2.0/2.5 reference video, MiniMax H3 Fun ControlNet, Wan VACE.+- Code, CLI, docs: https://github.com/maosika-ai/reshot (Apache-2.0)+- Model: Video Depth Anything Small (Apache-2.0, ByteDance, CVPR 2025)+- Try it in the browser: https://huggingface.co/spaces/netbee/reshot (free GPU). Locally: `pip install reshot`.++ReShot is open-sourced by [Maosika 猫斯卡](https://www.maosika.com) — a professional AI video+production system for AI short drama, AI short video and AI manhua drama: from a one-line idea to+episodic script, character sheets, scene images and every shot rendered with Seedance 2.0/2.5 and+MiniMax H3. https://www.maosika.comdiff --git a/demo/space/demo.gif b/demo/landing/demo.gifsimilarity index 100%rename from demo/space/demo.gifrename to demo/landing/demo.gifdiff --git a/demo/space/demo.mp4 b/demo/landing/demo.mp4similarity index 100%rename from demo/space/demo.mp4rename to demo/landing/demo.mp4diff --git a/demo/space/index.html b/demo/landing/index.htmlsimilarity index 94%rename from demo/space/index.htmlrename to demo/landing/index.htmlindex 5106ee1..0320ca1 100644--- a/demo/space/index.html+++ b/demo/landing/index.html@@ -35,6 +35,11 @@<video class="demo" src="demo.mp4" poster="demo.gif" autoplay muted loop playsinline></video><p class="cap">top: the reference and its depth map · bottom: three takes generated from that depth map — two women, one rabbit; same moves, same camera<br><span class="zh">上排:参考片和它的深度图 · 下排:用这张深度图生成的三段片——两个女人、一只兔子;动作一样,镜头一样</span></p>+<div class="row">+ <a class="btn" href="https://huggingface.co/spaces/netbee/reshot">Try it in your browser — free GPU, no install · 在线试用,免安装</a>+</div>+<p class="cap">Drop a clip up to 15 s, get <code>depth.mp4</code> and the prompt line back in about 30 seconds.<br><span class="zh">拖一段 15 秒以内的视频进去,30 秒左右拿到 depth.mp4 和提示词。</span></p>+<pre><code>pip install reshotreshot # opens a page in your browser — drop the clip in, click, downloadreshot reference.mp4 -o depth.mp4 --target seedance # or the command line</code></pre>@@ -43,7 +48,7 @@ reshot reference.mp4 -o depth.mp4 --target seedance # or the command line</c<p class="cap">The web page (<code>reshot</code> with nothing after it): everything runs on your own computer; the prompt line for Seedance or MiniMax H3 is right there to copy.<br><span class="zh">网页版(只敲 <code>reshot</code>):全部在你自己电脑上跑;给 Seedance / MiniMax H3 的提示词就在旁边,点一下复制。</span></p><div class="row">- <a class="btn" href="https://github.com/maosika-ai/reshot">GitHub · code & docs</a>+ <a class="ghost" href="https://github.com/maosika-ai/reshot">GitHub · code & docs</a><a class="ghost" href="https://github.com/maosika-ai/reshot/blob/main/docs/USAGE.md">User guide</a><a class="ghost" href="https://github.com/maosika-ai/reshot/blob/main/docs/USAGE.zh-CN.md">中文手册</a><a class="ghost" href="https://www.maosika.com">Maosika 猫斯卡 · make AI short drama</a>@@ -102,5 +107,5 @@ reshot reference.mp4 -o depth.mp4 --target seedance # or the command line</c<p><a class="btn" href="https://www.maosika.com">Make AI short drama at maosika.com · 去猫斯卡做 AI 短剧</a></p></div>-<footer>Apache-2.0 · model code vendored from <a href="https://github.com/DepthAnything/Video-Depth-Anything">Video Depth Anything</a> (CVPR 2025) · built at <a href="https://www.maosika.com">Maosika 猫斯卡 · www.maosika.com</a>. This Space is a landing page; the tool runs locally.</footer>+<footer>Apache-2.0 · model code vendored from <a href="https://github.com/DepthAnything/Video-Depth-Anything">Video Depth Anything</a> (CVPR 2025) · built at <a href="https://www.maosika.com">Maosika 猫斯卡 · www.maosika.com</a>. Try it at <a href="https://huggingface.co/spaces/netbee/reshot">spaces/netbee/reshot</a>, or run it locally with <code>pip install reshot</code>.</footer></main></body></html>diff --git a/demo/space/web_ui.jpg b/demo/landing/web_ui.jpgsimilarity index 100%rename from demo/space/web_ui.jpgrename to demo/landing/web_ui.jpgdiff --git a/demo/requirements.txt b/demo/requirements.txtindex ed684df..03ed930 100644--- a/demo/requirements.txt+++ b/demo/requirements.txt@@ -1,5 +1,5 @@--extra-index-url https://download.pytorch.org/whl/cputorchtorchvision-reshot[ffmpeg]==0.4.0+reshot[ffmpeg]==0.4.1gradio>=4.0diff --git a/demo/space/README.md b/demo/space/README.mdindex a5d092d..9d281e7 100644--- a/demo/space/README.md+++ b/demo/space/README.md@@ -3,24 +3,25 @@ title: ReShotemoji: 🎬colorFrom: graycolorTo: yellow-sdk: static+sdk: gradio+sdk_version: "5.49.1"+python_version: "3.12"+app_file: app.pypinned: falselicense: apache-2.0-short_description: Copy the shot, not the actors. By Maosika 猫斯卡.+short_description: Copy the shot, not the actors. Video → depth map. By Maosika.---# ReShot-Copy the shot, not the actors. ReShot turns any reference video into a depth map — the-control signal that lets a video model copy a shot's **staging and camera** without copying-its faces, wardrobe or style.+Copy the shot, not the actors. ReShot turns a reference video into a depth map — the control+signal that lets a video model copy a shot's **staging and camera** without copying its faces,+wardrobe or style.-- Presets for Seedance 2.0/2.5 reference video, MiniMax H3 Fun ControlNet, Wan VACE.-- Code, CLI, docs: https://github.com/maosika-ai/reshot (Apache-2.0)+- Presets for Seedance 2.0 / 2.5 reference video, MiniMax H3 Fun ControlNet, Wan VACE.+- Code, CLI, local web page, docs: https://github.com/maosika-ai/reshot (Apache-2.0)- Model: Video Depth Anything Small (Apache-2.0, ByteDance, CVPR 2025)-- This Space is a static landing page; the tool runs locally (`pip install reshot`).-ReShot is open-sourced by [Maosika 猫斯卡](https://www.maosika.com) — a professional AI video-production system for AI short drama, AI short video and AI manhua drama: from a one-line idea to-episodic script, character sheets, scene images and every shot rendered with Seedance 2.0/2.5 and-MiniMax H3. https://www.maosika.com+Open-sourced by [Maosika 猫斯卡](https://www.maosika.com) — the AI short-drama production system:+from a one-line idea to episodic script, character sheets, scene images and every shot rendered+with Seedance 2.0 / 2.5 and MiniMax H3.diff --git a/demo/space/app.py b/demo/space/app.pynew file mode 100644index 0000000..42b57a9--- /dev/null+++ b/demo/space/app.py@@ -0,0 +1,172 @@+"""ReShot — Hugging Face Space (ZeroGPU).++Drop a clip, get its depth-map video back, plus the prompt line that points a video model at+it. The same `reshot.run()` the CLI and the local web page use does the work; this file is only+the Gradio UI and the ZeroGPU plumbing.++ZeroGPU rules that shape this file (docs/hub/spaces-zerogpu):+- the model must be placed on `cuda` at import time (CUDA is emulated outside `@spaces.GPU`),+ so one backend is built here and handed to `run(..., backend=BACKEND)` for every clip;+- only the decorated function gets a real GPU, and its `duration` is the visitor's quota cost,+ so it is computed per clip from the frame count rather than a flat maximum.++Runs unchanged on CPU / a normal GPU too: `@spaces.GPU` is a no-op outside ZeroGPU.+"""++from __future__ import annotations++import os+import tempfile+from pathlib import Path++import cv2+import gradio as gr+import spaces++from reshot import RunConfig, __version__, run+from reshot.backends import get_backend+from reshot.errors import ReshotError++MAX_SECONDS = 15 # the longest clip Seedance / MiniMax H3 accept as a reference; longer input is cut+FPS = 24 # every preset here is 24 fps; `none` keeps the source, capped by MAX_FRAMES anyway+MAX_FRAMES = MAX_SECONDS * FPS+FAKE = bool(os.environ.get("RESHOT_FAKE_BACKEND")) # local smoke test without weights / GPU++# Built once at import, on cuda (emulated until a @spaces.GPU call), reused for every clip.+BACKEND = get_backend("fake") if FAKE else get_backend("vda", model="small", device="cuda")++# What to do with the file, per preset — the same lines the local web page shows.+NEXT_STEP = {+ "seedance": (+ "Upload `depth.mp4` to **Seedance 2.0 / 2.5** as a reference video and start the prompt with:",+ "参考@视频1的动作与运镜,顺序与视频保持一致。\n(then describe your people, wardrobe, set and look)",+ ),+ "h3": (+ "In **MiniMax H3** attach `depth.mp4` as `<Video 1>` (a character sheet as `<Picture 1>`), "+ "define it in the prompt and say the grey look is not to be copied:",+ "<Subject 3> is the choreography and camera movement shown in <Video 1>, a grey depth map "+ "in which near objects are white and far objects are black: (one sentence on what happens in the clip)\n"+ "<Subject 3>: attribute_transfer - every action, position, timing and camera move of <Video 1> "+ "is transferred onto <Subject 1>; its grey depth look is not transferred.",+ ),+ "wan": ("Connect `depth.mp4` to **WanVaceToVideo → control_video** in ComfyUI.", ""),+ "none": ("Hand `depth.mp4` to any model that reads a depth video.", ""),+}+++def _frame_count(video: str) -> int:+ cap = cv2.VideoCapture(video)+ n, fps = cap.get(cv2.CAP_PROP_FRAME_COUNT), cap.get(cv2.CAP_PROP_FPS) or FPS+ cap.release()+ # frames that will actually be processed: resampled to 24 fps, then cut at MAX_FRAMES+ return int(min(max(n, 1) * FPS / fps, MAX_FRAMES))+++def gpu_seconds(video: str | None, target: str, quality: str, invert: bool, gamma: float) -> int:+ """Quota to reserve for one clip: read + model + encode. Measured on a 4090: ~35 ms/frame at+ `fast`, ~85 ms at `full` (docs/USAGE.md); the rest is decode/encode on the CPU side. Padded+ so a clip never dies at the deadline, kept small so visitors get a good queue position."""+ if not video:+ return 10+ per_frame = 0.25 if quality == "full" else 0.12+ return int(min(120, 15 + _frame_count(video) * per_frame))++[email protected](duration=gpu_seconds)+def make_depth_map(video: str | None, target: str, quality: str, invert: bool, gamma: float):+ if not video:+ raise gr.Error("Drop a clip in first.")+ workdir = Path(tempfile.mkdtemp(prefix="reshot-"))+ cfg = RunConfig(+ input=Path(video),+ output=workdir / "depth.mp4",+ backend="fake" if FAKE else "vda",+ device="cuda",+ target=target,+ max_frames=MAX_FRAMES,+ quality=quality,+ invert=invert,+ gamma=gamma,+ metrics=workdir / "metrics.json",+ )+ try:+ res = run(cfg, backend=BACKEND)+ except ReshotError as exc:+ raise gr.Error(str(exc)) from exc+ cut = " · first 15 s" if _frame_count(video) >= MAX_FRAMES else ""+ stats = (+ f"{res.frames} frames · {res.fps:.0f} fps · {res.width}×{res.height} · "+ f"{res.ms_per_frame:.0f} ms/frame on {res.device}{cut} · reshot {__version__}"+ )+ how, prompt = NEXT_STEP[target]+ return str(res.output), stats, how, gr.update(value=prompt, visible=bool(prompt))+++CSS = """+.gradio-container { max-width: 1100px !important; }+#prompt textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }+"""++with gr.Blocks(title="ReShot — copy the shot, not the actors", css=CSS) as demo:+ gr.Markdown(+ """+# ReShot+**Copy the shot, not the actors.** Drop a reference clip; you get its **depth map** back — a grey+video that keeps where everyone stands, how they move and how the camera moves, and drops faces,+clothes and style. Give it to Seedance or MiniMax H3 as the reference and describe your own+characters in the prompt.++Free GPU (ZeroGPU): a 12-second clip takes about 30 seconds. Clips longer than 15 s are cut to 15 s —+that is what the video models accept. Everything is deleted when you leave the page.+[GitHub](https://github.com/maosika-ai/reshot) · `pip install reshot` runs it locally on any clip length ·+[ComfyUI nodes](https://github.com/maosika-ai/ComfyUI-ReShot) · [Show what you made](https://github.com/maosika-ai/reshot/discussions/2)+"""+ )+ with gr.Row():+ with gr.Column():+ src = gr.Video(label="Reference clip (mp4 / mov / webm)", sources=["upload"])+ target = gr.Radio(+ choices=[+ ("Seedance 2.0 / 2.5", "seedance"),+ ("MiniMax H3", "h3"),+ ("Wan 2.1 VACE", "wan"),+ ("Just the depth map", "none"),+ ],+ value="seedance",+ label="Which model is it for?",+ info="Sets fps and frame size to that model's reference-video rules.",+ )+ quality = gr.Radio(+ choices=[("fast", "fast"), ("full", "full")],+ value="fast",+ label="Quality",+ info="fast: large shapes identical, fine detail softer · full: sharper edges, ~2× the GPU time",+ )+ with gr.Accordion("Advanced", open=False):+ invert = gr.Checkbox(False, label="Invert (far = white)")+ gamma = gr.Slider(0.6, 1.8, value=1.0, step=0.05, label="Gamma")+ btn = gr.Button("Make depth map", variant="primary")+ with gr.Column():+ out = gr.Video(label="Depth map — download this", autoplay=True)+ stats = gr.Markdown()+ how = gr.Markdown()+ prompt = gr.Textbox(+ label="Prompt line to paste", lines=4, show_copy_button=True, visible=False, elem_id="prompt"+ )+ btn.click(make_depth_map, [src, target, quality, invert, gamma], [out, stats, how, prompt])+ ex = Path(__file__).with_name("example.mp4")+ if ex.exists():+ gr.Examples(+ [[str(ex), "seedance", "fast", False, 1.0]],+ [src, target, quality, invert, gamma],+ label="Try it with the demo clip (12 s, a corridor fight rendered by Seedance)",+ )+ gr.Markdown(+ """+<sub>ReShot is Apache-2.0, open-sourced by <a href="https://www.maosika.com">Maosika 猫斯卡</a>, the AI short-drama+production system. Model: Video Depth Anything Small (Apache-2.0, ByteDance, CVPR 2025).</sub>+"""+ )++if __name__ == "__main__":+ demo.queue().launch()diff --git a/demo/space/example.mp4 b/demo/space/example.mp4new file mode 100644index 0000000..b8a518cBinary files /dev/null and b/demo/space/example.mp4 differdiff --git a/demo/space/requirements.txt b/demo/space/requirements.txtnew file mode 100644index 0000000..9ac973f--- /dev/null+++ b/demo/space/requirements.txt@@ -0,0 +1,5 @@+torch==2.13.0+torchvision==0.28.0+reshot[ffmpeg] @ git+https://github.com/maosika-ai/[email protected]+gradio>=5,<6+spacesdiff --git a/reshot/_version.py b/reshot/_version.pyindex 6a9beea..3d26edf 100644--- a/reshot/_version.py+++ b/reshot/_version.py@@ -1 +1 @@-__version__ = "0.4.0"+__version__ = "0.4.1"diff --git a/reshot/pipeline.py b/reshot/pipeline.pyindex cac55e3..77e8768 100644--- a/reshot/pipeline.py+++ b/reshot/pipeline.py@@ -176,8 +176,16 @@ def run_many(cfgs: list[RunConfig], reporter: Reporter | None = None) -> list[Rureturn results-def run(cfg: RunConfig, reporter: Reporter | None = None) -> RunResult:- """Execute a full run. See module docstring."""+def run(cfg: RunConfig, reporter: Reporter | None = None, *, backend=None) -> RunResult:+ """Execute a full run. See module docstring.++ `backend`: an already-built `DepthBackend` to run on. A long-lived process (a server,+ a Hugging Face Space) builds one at startup and passes it here so the weights are not+ reloaded per clip; the caller then owns its lifetime and nothing is released on return.+ Without it, a backend is built for this run and torn down afterwards, as before.+ """+ if backend is not None:+ return _run_one(cfg, reporter or NullReporter(), backend, cfg.backend)backend, backend_name = _make_backend(cfg)try:return _run_one(cfg, reporter or NullReporter(), backend, backend_name)diff --git a/tests/test_pipeline.py b/tests/test_pipeline.pyindex 00e3a58..778fa5a 100644--- a/tests/test_pipeline.py+++ b/tests/test_pipeline.py@@ -162,3 +162,16 @@ def test_model_input_resolution_matches_the_vendored_resize():assert mir(720, 1280, 364) == (364, 644) and mir(720, 1280, 518) == (518, 924)assert mir(1024, 768, 364) == (490, 364) and mir(1024, 768, 518) == (686, 518)assert mir(1080, 1080, 518) == (518, 518)+++def test_run_reuses_a_prebuilt_backend(tmp_path, monkeypatch):+ """A resident process passes its own backend: run() must use it and must not build one."""+ from reshot import pipeline+ from reshot.backends import get_backend++ monkeypatch.setattr(pipeline, "_make_backend", lambda cfg: pytest.fail("run() built a backend it was given"))+ shared = get_backend("fake")+ src = _clip(tmp_path / "src.mp4")+ a = run(RunConfig(input=src, output=tmp_path / "a.mp4", backend="fake", target="seedance"), backend=shared)+ b = run(RunConfig(input=src, output=tmp_path / "b.mp4", backend="fake", target="seedance"), backend=shared)+ assert a.output.exists() and b.output.exists() and a.frames == b.frames