Integrate model adapter for a demo
An adapter is a package that contains the logic to connect a demo to a model.
In this example we connect the Minimal T2V application to Wan 2.1.
Files to add or update
After creating apps/minimal_t2v/, add the adapter package and update the website:
integrations_v2/wan21/
config.py # add a new pipeline config if desired
apps/minimal_t2v/
__init__.py # add the package initializer
adapter.py # add the application factory
pyproject.toml # update dependencies, packages, and entry points
docs/source/
models/
wan21.md # update: add Minimal T2V quick start, preset, and app-page link
.nav.yml # update when adding a new model page
index.md # add a card when adding a new model page
demos/
minimal_t2v.md # update: link to the model's quick start
Create the adapter entry point
Our adapter entry point is a factory function that creates an instance of our application based on the IApplication we defined.
This factory has the contract of:
def some_create_app() -> IApplication:
...
In our case we then make in integrations_v2/wan21/apps/minimal_t2v/adapter.py:
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Wan 2.1 adapter for the Minimal T2V application."""
from minimal_t2v import MinimalT2VApplication
from flashdreams.runtime_v2.session_desc import SessionDesc
from wan21.config import PIPELINE_WAN21_T2V_1PT3B_480P
def create_app() -> MinimalT2VApplication:
"""Return Minimal T2V with Wan 2.1's single-block pipeline."""
return MinimalT2VApplication(
pipeline_config=PIPELINE_WAN21_T2V_1PT3B_480P,
desc=SessionDesc(
video_width=832,
video_height=480,
frames_per_second_for_step=16,
),
total_blocks=1,
)
Register the application
In integrations_v2/wan21/pyproject.toml, add our application's package name to tool.uv.sources
Then add our slug to run our new application entry point to [project.entry-points."flashdreams.applications_v2"]
This is seen in integrations_v2/wan21/pyproject.toml:
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
[build-system]
requires = ["setuptools>=69", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "flashdreams-wan21"
version = "0.1.0"
description = "Wan 2.1 T2V + I2V non-streaming inference plugin for flashdreams."
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"flashdreams",
"mediapy>=1.1",
"opencv-python-headless>=4.5",
"flashdreams-t2v",
"flashdreams-minimal-t2v",
]
[tool.uv.sources]
flashdreams-t2v = { workspace = true }
flashdreams-minimal-t2v = { workspace = true }
flashdreams = { workspace = true }
[project.optional-dependencies]
dev = [
"pytest>=8.0",
]
[project.entry-points."flashdreams.applications_v2"]
"t2v-wan21-t2v-1.3b-480p" = "wan21.apps.t2v.adapter:create_app"
"minimal-t2v-wan21" = "wan21.apps.minimal_t2v.adapter:create_app"
[tool.setuptools]
packages = ["wan21", "wan21.apps", "wan21.apps.t2v", "wan21.apps.minimal_t2v", "wan21.impl"]
[tool.setuptools.package-dir]
wan21 = "."
[tool.uv]
managed = true
Install and run entry point
uv sync --package flashdreams-wan21 --inexact
uv run --no-sync flashdreams-run-v2 minimal-t2v-wan21 --mode native-window -- --default-prompt "A cat surfing"
Adding a new pipeline configuration to pick from
Modify integrations_v2/wan21/config.py to add a new pipeline config to wan21:
PIPELINE_WAN21_T2V_SEED123 = derive_config(
PIPELINE_WAN21_T2V_1PT3B_480P,
name="wan21-t2v-1.3b-480p-seed123",
diffusion_model={"seed": 123},
)
This defines a new pipeline config that is a copy of PIPELINE_WAN21_T2V_1PT3B_480P with the addition of a seed parameter to the diffusion model, setting the pipeline to always run diffusion with the same seed of 123.
To learn more about demo serving, see Interactive serving.