AI generation¶
Generate video, images, speech and music from text prompts. All local — see Local-only AI for the hardware each one needs.
| Class | Local model family |
|---|---|
TextToVideo |
Wan2.2-T2V-A14B |
ImageToVideo |
Wan2.2-I2V-A14B |
TextToImage |
Qwen-Image |
TextToSpeech |
Chatterbox Multilingual |
TextToMusic |
MusicGen |
A worked pipeline: Assemble a video from AI-generated media.
TextToVideo
¶
Bases: ManagedPredictor
Generates videos from text descriptions using Wan2.2-T2V (Apache-2.0).
Source code in src/videopython/ai/generation/video.py
generate_video
¶
generate_video(
prompt: str,
num_steps: int = 40,
num_frames: int = 81,
guidance_scale: float = 4.0,
) -> Video
Generate video from text prompt.
Source code in src/videopython/ai/generation/video.py
ImageToVideo
¶
Bases: ManagedPredictor
Generates videos from static images using Wan2.2-I2V (Apache-2.0).
Source code in src/videopython/ai/generation/video.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
generate_video
¶
generate_video(
image: Image,
prompt: str = "",
num_steps: int = 40,
num_frames: int = 81,
guidance_scale: float = 3.5,
) -> Video
Generate video animation from a static image.
Source code in src/videopython/ai/generation/video.py
TextToImage
¶
Bases: ManagedPredictor
Generates images from text descriptions using local models (Qwen-Image, Apache-2.0).
Source code in src/videopython/ai/generation/image.py
generate_image
¶
generate_image(
prompt: str,
*,
negative_prompt: str = " ",
true_cfg_scale: float = 4.0,
num_inference_steps: int = 50,
width: int = 1328,
height: int = 1328,
add_magic: bool = True,
seed: int = 42,
) -> Image.Image
Generate an image from a text prompt.
Qwen-Image uses true_cfg_scale (not guidance_scale) for
classifier-free guidance; a non-empty negative_prompt (default a single
space) is required to enable it. add_magic appends the model's
recommended quality suffix to prompt.
Source code in src/videopython/ai/generation/image.py
TextToSpeech¶
generate_audio accepts three optional Chatterbox generate() knobs — exaggeration,
cfg_weight and temperature. Each defaults to None, which means "do not pass the
kwarg; let Chatterbox use its default". The dubbing pipeline derives them per segment from
source vocals RMS via Expressiveness.
from videopython.ai import TextToSpeech
tts = TextToSpeech()
audio = tts.generate_audio("Welcome to videopython.")
dramatic = tts.generate_audio("We made it.", exaggeration=0.85, cfg_weight=0.35)
TextToSpeech
¶
Bases: ManagedPredictor
Generates speech audio from text using Chatterbox Multilingual.
Backed by Chatterbox Multilingual (Resemble AI). When voice_sample is
provided to generate_audio, the model clones that voice; otherwise it
falls back to Chatterbox's built-in default speaker.
Source code in src/videopython/ai/generation/audio.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
generate_audio
¶
generate_audio(
text: str,
voice_sample: Audio | None = None,
voice_sample_path: str | Path | None = None,
exaggeration: float | None = None,
cfg_weight: float | None = None,
temperature: float | None = None,
) -> Audio
Generate speech audio from text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text to synthesize. |
required |
voice_sample
|
Audio | None
|
Optional voice sample to clone. Falls back to the
instance's |
None
|
voice_sample_path
|
str | Path | None
|
Optional pre-encoded WAV path to use directly as
the speaker prompt. Skips the per-call temp-WAV encode that
|
None
|
exaggeration
|
float | None
|
Chatterbox emotional-intensity knob (default
|
None
|
cfg_weight
|
float | None
|
Chatterbox classifier-free-guidance weight (default
|
None
|
temperature
|
float | None
|
Chatterbox sampling temperature (default |
None
|
Source code in src/videopython/ai/generation/audio.py
TextToMusic
¶
Bases: ManagedPredictor
Generates music from text descriptions using MusicGen.
Source code in src/videopython/ai/generation/audio.py
generate_audio
¶
Generate music audio from text description.