Pipelines are the core abstraction for handling streaming video in Scope. A pipeline encapsulates model loading, inference logic, configuration schemas, and metadata.
All pipelines inherit from the abstract Pipeline class:
from abc import ABC, abstractmethodclass Pipeline(ABC): @classmethod def get_config_class(cls) -> type["BasePipelineConfig"]: """Return the Pydantic config class for this pipeline.""" ... @abstractmethod def __call__(self, **kwargs) -> dict: """Process video frames and return results.""" pass
Method
Purpose
get_config_class()
Returns the Pydantic config class that defines parameters and metadata
__call__()
Processes input frames and returns generated video
from scope.core.pipelines.interface import Requirementsclass MyPipeline(Pipeline): def prepare(self, **kwargs) -> Requirements: return Requirements(input_size=4) def __call__(self, **kwargs) -> dict: video = kwargs.get("video") # List of 4 frames # ... process video ...
Pipelines that support both text-to-video and video-to-video modes use the prepare_for_mode() helper from defaults.py:
from scope.core.pipelines.defaults import prepare_for_modefrom scope.core.pipelines.interface import Requirementsclass LongLivePipeline(Pipeline): def prepare(self, **kwargs) -> Requirements | None: """Return input requirements based on current mode.""" return prepare_for_mode(self.__class__, self.components.config, kwargs)
The helper returns Requirements when video mode is active (indicated by video=True in kwargs) and None for text mode. The input_size is calculated from the pipeline’s configuration.Why implement prepare():
Without it, the frame processor cannot know how many frames to buffer before calling __call__()
Enables efficient queue management - the processor sizes queues based on requirements
Allows multi-mode pipelines to dynamically switch between text and video input modes
Pydantic models automatically generate JSON Schema via model_json_schema(). The backend exposes this schema through the /pipelines endpoint, which the frontend consumes for dynamic UI rendering.The schema includes:
Field types and validation constraints (minimum, maximum, enum)
For fields without a component specified, the frontend automatically renders an appropriate widget based on the JSON Schema type. The frontend (schemaSettings.ts) infers widget types from schema properties:
The UI uses a two-tier approach: primitive fields render as individual widgets based on inferred type, while complex components group related fields into unified UI blocks.
Built-in pipelines are registered automatically when the registry module is imported.Node pipelines register through the pluggy hook system:
from scope.core.plugins.hookspecs import hookimpl@hookimpldef register_pipelines(register): from .pipelines import MyCustomPipeline register(MyCustomPipeline)
Pipelines with estimated_vram_gb set are only registered if a compatible GPU is detected. This prevents showing pipelines that cannot run on the current hardware.