def predict(
        self,
        prompt: str = Input(description="Input prompt."),
        image: Path = Input(description="Input image"),
        negative_prompt: str = Input(description="Things do not show in the output.", default=N_PROMPT),
        style: str = Input(
            description="Choose a style",
            choices=["3d_cartoon", "realistic"],
            default="3d_cartoon",
        ),
        max_size: int = Input(
            description="Max size (The long edge of the input image will be resized to this value, "
            "larger value means slower inference speed)",
            default=512,
            choices=[512, 576, 640, 704, 768, 832, 896, 960, 1024],
        ),
        motion_scale: int = Input(
            description="Larger value means larger motion but less identity consistency.",
            ge=1,
            le=3,
            default=1,
        ),
        sampling_steps: int = Input(description="Number of denoising steps", ge=10, le=100, default=25),
        animation_length: int = Input(description="Length of the output", ge=8, le=24, default=16),
        guidance_scale: float = Input(
            description="Scale for classifier-free guidance",
            ge=1.0,
            le=20.0,
            default=7.5,
        ),
        ip_adapter_scale: float = Input(
            description="Scale for classifier-free guidance",
            ge=0.0,
            le=1.0,
            default=0.0,
        ),
        seed: int = Input(description="Random seed. Leave blank to randomize the seed", default=None),
    ) -> Path:
        """Run a single prediction on the model"""
        if seed is None:
            torch.seed()
            seed = torch.initial_seed()
        else:
            torch.manual_seed(seed)
        print(f"Using seed: {seed}")

        pipeline = self.pipeline_dict[style]

        init_img, h, w = preprocess_img(str(image), max_size)

        sample = pipeline(
            image=init_img,
            prompt=prompt,
            negative_prompt=negative_prompt,
            num_inference_steps=sampling_steps,
            guidance_scale=guidance_scale,
            width=w,
            height=h,
            video_length=animation_length,
            mask_sim_template_idx=motion_scale,
            ip_adapter_scale=ip_adapter_scale,
        ).videos

        out_path = "/tmp/out.mp4"
        save_videos_grid(sample, out_path)
        return Path(out_path)
Run a single prediction on the model
predict.py