lcode-cli 0.45.0__py3-none-any.whl → 0.47.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lcode/media.toml CHANGED
@@ -101,6 +101,7 @@ publisher = "Xintao Wang et al."
101
101
  license = "BSD-3-Clause"
102
102
  tasks = ["upscale"]
103
103
  workflow = "upscale-esrgan"
104
+ video_workflow = "upscale-video-esrgan"
104
105
  files = { model = "realesrgan-x4" }
105
106
  notes = "/upscale: 2× or 4× the pixels"
106
107
 
@@ -196,3 +197,60 @@ measured = "3 s clip (49 frames, 832×480): 115 s on an RTX 4080 Laptop, 12 GB"
196
197
  notes = "camera moves (--camera pan-left, zoom-in, …), small and fast, 16 fps"
197
198
  quality = { fast = [12, 0.38], balanced = [20, 0.38], best = [30, 0.38] }
198
199
  negative = true
200
+
201
+ [files.wan21-vace-1-3b]
202
+ folder = "diffusion_models"
203
+ name = "wan2.1_vace_1.3B_fp16.safetensors"
204
+ url = "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/diffusion_models/wan2.1_vace_1.3B_fp16.safetensors"
205
+ gb = 4.31
206
+
207
+ [files.film-net]
208
+ folder = "frame_interpolation"
209
+ name = "film_net_fp16.safetensors"
210
+ url = "https://huggingface.co/Comfy-Org/frame_interpolation/resolve/main/frame_interpolation/film_net_fp16.safetensors"
211
+ gb = 0.07
212
+
213
+ [files.stable-audio-open]
214
+ folder = "checkpoints"
215
+ name = "stable-audio-open-1.0.safetensors"
216
+ url = "https://huggingface.co/Comfy-Org/stable-audio-open-1.0_repackaged/resolve/main/stable-audio-open-1.0.safetensors"
217
+ gb = 4.85
218
+
219
+ [files.t5-base]
220
+ folder = "text_encoders"
221
+ name = "t5-base.safetensors"
222
+ url = "https://huggingface.co/ComfyUI-Wiki/t5-base/resolve/main/t5-base.safetensors"
223
+ gb = 0.89
224
+
225
+ [models.wan21-vace-1-3b]
226
+ name = "Wan 2.1 VACE 1.3B"
227
+ mode = "video"
228
+ publisher = "Alibaba (Wan-AI)"
229
+ license = "Apache 2.0"
230
+ tasks = ["references", "restyle"]
231
+ workflow = "wan21-vace"
232
+ files = { model = "wan21-vace-1-3b", text_encoder = "umt5-xxl-fp8", vae = "wan21-vae" }
233
+ measured = "3 s clip from references (832×480): 190 s; restyling 3 s: 320 s, on an RTX 4080 Laptop, 12 GB"
234
+ notes = "clips that follow reference pictures (--ref), or restyle a clip (/restyle)"
235
+ quality = { fast = [12, 0.38], balanced = [20, 0.38], best = [30, 0.38] }
236
+ negative = true
237
+
238
+ [models.film]
239
+ name = "FILM"
240
+ mode = "tool"
241
+ publisher = "Google Research"
242
+ license = "Apache 2.0"
243
+ tasks = ["interpolate"]
244
+ workflow = "smooth-film"
245
+ files = { model = "film-net" }
246
+ notes = "/smooth: twice the frames per second"
247
+
248
+ [models.stable-audio-open]
249
+ name = "Stable Audio Open 1.0"
250
+ mode = "tool"
251
+ publisher = "Stability AI"
252
+ license = "Stability AI Community License"
253
+ tasks = ["sound"]
254
+ workflow = "sound-stable-audio"
255
+ files = { model = "stable-audio-open", text_encoder = "t5-base" }
256
+ notes = "/sound: sound effects and ambience for a clip, up to 47 s"
lcode/media_catalog.py CHANGED
@@ -71,6 +71,7 @@ class MediaModel:
71
71
  quality: dict[str, tuple[int, float]] = field(default_factory=dict, hash=False) # preset -> (steps, megapixels)
72
72
  negative: bool = False # whether it uses a negative prompt
73
73
  edit: str = "" # how it edits images ("reference-latent"), or empty: it doesn't
74
+ video_workflow: str = "" # a tool's workflow for clips, when it works on them too (upscaling)
74
75
 
75
76
  def preset(self, quality: str) -> tuple[int | None, float]:
76
77
  """(steps, megapixels) for a quality preset: None steps keeps the workflow's."""
@@ -163,6 +164,7 @@ def load() -> Catalog:
163
164
  {name: (int(v[0]), float(v[1])) for name, v in (m.get("quality") or {}).items()},
164
165
  bool(m.get("negative", False)),
165
166
  m.get("edit", ""),
167
+ m.get("video_workflow", ""),
166
168
  )
167
169
  return Catalog(files, models)
168
170
 
lcode/repl.py CHANGED
@@ -87,9 +87,12 @@ COMMANDS = {
87
87
  "/edit": "Image mode: change an image by instruction, e.g. /edit 3 make the sky purple (@photo.png: references)",
88
88
  "/use": "Image mode: images the next requests follow, e.g. /use 3 or /use photo.png (/use off)",
89
89
  "/extend": "Outpaint an image (/extend 3 --ar 16:9), or continue a clip in video mode (/extend 4 --seconds 3)",
90
- "/upscale": "Image mode: 2 or 4 times the pixels, e.g. /upscale 3 4",
90
+ "/upscale": "2 or 4 times the pixels of an image or a clip, e.g. /upscale 3 4",
91
91
  "/nobg": "Image mode: remove the background (a transparent PNG), e.g. /nobg 3",
92
92
  "/animate": "Image mode: make a video starting from an image, e.g. /animate 3 the waves roll in (video mode)",
93
+ "/smooth": "Video mode: 2 or 4 times the frames (smoother motion), e.g. /smooth 4",
94
+ "/sound": "Video mode: add sound to a clip, e.g. /sound 4 waves and seagulls",
95
+ "/restyle": "Video mode: the same clip in a new look, e.g. /restyle 4 as a watercolor painting",
93
96
  "/play": "Play a video in your player, e.g. /play 4 (default: the last)",
94
97
  "/cd": "Change the working directory",
95
98
  "/todos": "Show the current todo list",
@@ -1404,9 +1407,12 @@ def respond(agent: Agent, line: str) -> None:
1404
1407
 
1405
1408
  IMAGE_COMMANDS = (
1406
1409
  "/options", "/again", "/vary", "/gallery", "/open", "/play", "/edit", "/use", "/extend", "/upscale", "/nobg",
1407
- "/animate",
1410
+ "/animate", "/smooth", "/sound", "/restyle",
1408
1411
  ) # fmt: skip
1409
- VIDEO_TOO = ("/options", "/again", "/vary", "/gallery", "/open", "/play", "/use", "/extend") # video mode has these
1412
+ VIDEO_TOO = (
1413
+ "/options", "/again", "/vary", "/gallery", "/open", "/play", "/use", "/extend", "/upscale", "/smooth", "/sound",
1414
+ "/restyle",
1415
+ ) # what video mode has # fmt: skip
1410
1416
  NUMBER = re.compile(r"^#?(\d+)$")
1411
1417
 
1412
1418
 
@@ -1464,7 +1470,8 @@ def image_command(agent: Agent, cmd: str, arg: str) -> None:
1464
1470
  return
1465
1471
  if cmd == "/vary":
1466
1472
  job = dict(entry.get("job") or {"kind": "image", "sources": [], "mask": None, "pads": None})
1467
- if entry.get("kind") in ("upscale", "remove-background") or job["kind"] not in ("image", "edit", "video"):
1473
+ tools = ("upscale", "remove-background", "interpolate", "sound")
1474
+ if entry.get("kind") in tools or job["kind"] not in ("image", "edit", "video"):
1468
1475
  c.print(f"[yellow]#{entry['n']} is {escape(entry['prompt'])}: /vary the image it came from.[/]")
1469
1476
  return
1470
1477
  job["prompt"] = entry["prompt"] if job["kind"] == "image" else job.get("prompt", entry["prompt"])
@@ -1525,6 +1532,30 @@ def image_command(agent: Agent, cmd: str, arg: str) -> None:
1525
1532
  agent, run=lambda cancel, ask: media.apply_tool(agent, "upscale", source, int(scale), cancel, ask)
1526
1533
  )
1527
1534
  return
1535
+ if cmd == "/smooth":
1536
+ times = int(rest.strip().lower().rstrip("x×") or "2")
1537
+ if times not in (2, 4):
1538
+ c.print("[yellow]/smooth makes 2 or 4 times the frames: /smooth 4 2[/]")
1539
+ return
1540
+ make_image(
1541
+ agent, run=lambda cancel, ask: media.apply_tool(agent, "interpolate", source, times, cancel, ask)
1542
+ )
1543
+ return
1544
+ if cmd == "/sound":
1545
+ make_image(agent, run=lambda cancel, ask: media.apply_tool(agent, "sound", source, 1, cancel, ask, rest))
1546
+ return
1547
+ if cmd == "/restyle":
1548
+ if not media.is_video(source):
1549
+ c.print("[yellow]/restyle works on clips: /restyle 4 as a watercolor painting.[/]")
1550
+ return
1551
+ text, options = imageopts.parse(rest, imageopts.replace_seed(agent.image_options, n=1))
1552
+ if not text:
1553
+ c.print("[yellow]Say the new look: /restyle 4 as a watercolor painting[/]")
1554
+ return
1555
+ job = {"kind": "video", "prompt": text, "options": options, "sources": [], "mask": None, "pads": None,
1556
+ "keep_shape": True, "restyle": str(source), "seconds_given": "--seconds" in rest} # fmt: skip
1557
+ make_image(agent, run=lambda cancel, ask: media.redo(agent, job, cancel, ask))
1558
+ return
1528
1559
  if cmd == "/nobg":
1529
1560
  make_image(
1530
1561
  agent, run=lambda cancel, ask: media.apply_tool(agent, "remove-background", source, 2, cancel, ask)
@@ -0,0 +1,78 @@
1
+ {
2
+ "source": "ComfyUI's template utility_video_frame_interpolation, in API format",
3
+ "defaults": {
4
+ "multiplier": 2,
5
+ "fps": 48
6
+ },
7
+ "labels": {
8
+ "1": "loading the clip",
9
+ "2": "reading its frames",
10
+ "3": "loading FILM",
11
+ "4": "making the in-between frames",
12
+ "5": "making the video",
13
+ "6": "saving"
14
+ },
15
+ "graph": {
16
+ "1": {
17
+ "class_type": "LoadVideo",
18
+ "inputs": {
19
+ "file": "$video"
20
+ }
21
+ },
22
+ "2": {
23
+ "class_type": "GetVideoComponents",
24
+ "inputs": {
25
+ "video": [
26
+ "1",
27
+ 0
28
+ ]
29
+ }
30
+ },
31
+ "3": {
32
+ "class_type": "FrameInterpolationModelLoader",
33
+ "inputs": {
34
+ "model_name": "$model"
35
+ }
36
+ },
37
+ "4": {
38
+ "class_type": "FrameInterpolate",
39
+ "inputs": {
40
+ "interp_model": [
41
+ "3",
42
+ 0
43
+ ],
44
+ "images": [
45
+ "2",
46
+ 0
47
+ ],
48
+ "multiplier": "$multiplier"
49
+ }
50
+ },
51
+ "5": {
52
+ "class_type": "CreateVideo",
53
+ "inputs": {
54
+ "images": [
55
+ "4",
56
+ 0
57
+ ],
58
+ "audio": [
59
+ "2",
60
+ 1
61
+ ],
62
+ "fps": "$fps"
63
+ }
64
+ },
65
+ "6": {
66
+ "class_type": "SaveVideo",
67
+ "inputs": {
68
+ "video": [
69
+ "5",
70
+ 0
71
+ ],
72
+ "filename_prefix": "lcode/video",
73
+ "format": "mp4",
74
+ "codec": "auto"
75
+ }
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,144 @@
1
+ {
2
+ "source": "ComfyUI's template audio_stable_audio_example, in API format, with the sound put on the clip",
3
+ "defaults": {
4
+ "seconds": 5.0,
5
+ "fps": 24,
6
+ "steps": 50,
7
+ "negative": ""
8
+ },
9
+ "labels": {
10
+ "1": "loading the clip",
11
+ "2": "reading its frames",
12
+ "3": "loading Stable Audio",
13
+ "4": "loading the text encoder",
14
+ "5": "reading the prompt",
15
+ "8": "making the sound",
16
+ "9": "decoding the sound",
17
+ "10": "putting it on the clip",
18
+ "11": "saving"
19
+ },
20
+ "graph": {
21
+ "1": {
22
+ "class_type": "LoadVideo",
23
+ "inputs": {
24
+ "file": "$video"
25
+ }
26
+ },
27
+ "2": {
28
+ "class_type": "GetVideoComponents",
29
+ "inputs": {
30
+ "video": [
31
+ "1",
32
+ 0
33
+ ]
34
+ }
35
+ },
36
+ "3": {
37
+ "class_type": "CheckpointLoaderSimple",
38
+ "inputs": {
39
+ "ckpt_name": "$model"
40
+ }
41
+ },
42
+ "4": {
43
+ "class_type": "CLIPLoader",
44
+ "inputs": {
45
+ "clip_name": "$text_encoder",
46
+ "type": "stable_audio",
47
+ "device": "default"
48
+ }
49
+ },
50
+ "5": {
51
+ "class_type": "CLIPTextEncode",
52
+ "inputs": {
53
+ "text": "$prompt",
54
+ "clip": [
55
+ "4",
56
+ 0
57
+ ]
58
+ }
59
+ },
60
+ "6": {
61
+ "class_type": "CLIPTextEncode",
62
+ "inputs": {
63
+ "text": "$negative",
64
+ "clip": [
65
+ "4",
66
+ 0
67
+ ]
68
+ }
69
+ },
70
+ "7": {
71
+ "class_type": "EmptyLatentAudio",
72
+ "inputs": {
73
+ "seconds": "$seconds",
74
+ "batch_size": 1
75
+ }
76
+ },
77
+ "8": {
78
+ "class_type": "KSampler",
79
+ "inputs": {
80
+ "model": [
81
+ "3",
82
+ 0
83
+ ],
84
+ "seed": "$seed",
85
+ "steps": "$steps",
86
+ "cfg": 4.98,
87
+ "sampler_name": "dpmpp_3m_sde_gpu",
88
+ "scheduler": "exponential",
89
+ "positive": [
90
+ "5",
91
+ 0
92
+ ],
93
+ "negative": [
94
+ "6",
95
+ 0
96
+ ],
97
+ "latent_image": [
98
+ "7",
99
+ 0
100
+ ],
101
+ "denoise": 1
102
+ }
103
+ },
104
+ "9": {
105
+ "class_type": "VAEDecodeAudio",
106
+ "inputs": {
107
+ "samples": [
108
+ "8",
109
+ 0
110
+ ],
111
+ "vae": [
112
+ "3",
113
+ 2
114
+ ]
115
+ }
116
+ },
117
+ "10": {
118
+ "class_type": "CreateVideo",
119
+ "inputs": {
120
+ "images": [
121
+ "2",
122
+ 0
123
+ ],
124
+ "audio": [
125
+ "9",
126
+ 0
127
+ ],
128
+ "fps": "$fps"
129
+ }
130
+ },
131
+ "11": {
132
+ "class_type": "SaveVideo",
133
+ "inputs": {
134
+ "video": [
135
+ "10",
136
+ 0
137
+ ],
138
+ "filename_prefix": "lcode/video",
139
+ "format": "mp4",
140
+ "codec": "auto"
141
+ }
142
+ }
143
+ }
144
+ }
@@ -0,0 +1,89 @@
1
+ {
2
+ "source": "ComfyUI's template utility-gan_upscaler, in API format",
3
+ "defaults": {
4
+ "scale_by": 0.5,
5
+ "fps": 24
6
+ },
7
+ "labels": {
8
+ "1": "loading the clip",
9
+ "2": "reading its frames",
10
+ "3": "loading the upscaler",
11
+ "4": "upscaling the frames",
12
+ "5": "resizing",
13
+ "6": "making the video",
14
+ "7": "saving"
15
+ },
16
+ "graph": {
17
+ "1": {
18
+ "class_type": "LoadVideo",
19
+ "inputs": {
20
+ "file": "$video"
21
+ }
22
+ },
23
+ "2": {
24
+ "class_type": "GetVideoComponents",
25
+ "inputs": {
26
+ "video": [
27
+ "1",
28
+ 0
29
+ ]
30
+ }
31
+ },
32
+ "3": {
33
+ "class_type": "UpscaleModelLoader",
34
+ "inputs": {
35
+ "model_name": "$model"
36
+ }
37
+ },
38
+ "4": {
39
+ "class_type": "ImageUpscaleWithModel",
40
+ "inputs": {
41
+ "upscale_model": [
42
+ "3",
43
+ 0
44
+ ],
45
+ "image": [
46
+ "2",
47
+ 0
48
+ ]
49
+ }
50
+ },
51
+ "5": {
52
+ "class_type": "ImageScaleBy",
53
+ "inputs": {
54
+ "image": [
55
+ "4",
56
+ 0
57
+ ],
58
+ "upscale_method": "lanczos",
59
+ "scale_by": "$scale_by"
60
+ }
61
+ },
62
+ "6": {
63
+ "class_type": "CreateVideo",
64
+ "inputs": {
65
+ "images": [
66
+ "5",
67
+ 0
68
+ ],
69
+ "audio": [
70
+ "2",
71
+ 1
72
+ ],
73
+ "fps": "$fps"
74
+ }
75
+ },
76
+ "7": {
77
+ "class_type": "SaveVideo",
78
+ "inputs": {
79
+ "video": [
80
+ "6",
81
+ 0
82
+ ],
83
+ "filename_prefix": "lcode/video",
84
+ "format": "mp4",
85
+ "codec": "auto"
86
+ }
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,173 @@
1
+ {
2
+ "source": "ComfyUI's template video_wan_vace_14B_ref2v (the 1.3B model, without the CausVid LoRA), in API format; lcode adds the reference picture or the control video",
3
+ "defaults": {
4
+ "width": 832,
5
+ "height": 480,
6
+ "length": 81,
7
+ "fps": 16,
8
+ "steps": 20,
9
+ "negative": "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
10
+ },
11
+ "labels": {
12
+ "1": "loading the model",
13
+ "2": "loading the text encoder",
14
+ "3": "loading the VAE",
15
+ "5": "reading the prompt",
16
+ "6": "reading the prompt",
17
+ "7": "reading the references",
18
+ "8": "drawing the frames",
19
+ "10": "decoding the frames",
20
+ "11": "making the video",
21
+ "12": "saving"
22
+ },
23
+ "graph": {
24
+ "1": {
25
+ "class_type": "UNETLoader",
26
+ "inputs": {
27
+ "unet_name": "$model",
28
+ "weight_dtype": "default"
29
+ }
30
+ },
31
+ "2": {
32
+ "class_type": "CLIPLoader",
33
+ "inputs": {
34
+ "clip_name": "$text_encoder",
35
+ "type": "wan",
36
+ "device": "default"
37
+ }
38
+ },
39
+ "3": {
40
+ "class_type": "VAELoader",
41
+ "inputs": {
42
+ "vae_name": "$vae"
43
+ }
44
+ },
45
+ "4": {
46
+ "class_type": "ModelSamplingSD3",
47
+ "inputs": {
48
+ "model": [
49
+ "1",
50
+ 0
51
+ ],
52
+ "shift": 8
53
+ }
54
+ },
55
+ "5": {
56
+ "class_type": "CLIPTextEncode",
57
+ "inputs": {
58
+ "text": "$prompt",
59
+ "clip": [
60
+ "2",
61
+ 0
62
+ ]
63
+ }
64
+ },
65
+ "6": {
66
+ "class_type": "CLIPTextEncode",
67
+ "inputs": {
68
+ "text": "$negative",
69
+ "clip": [
70
+ "2",
71
+ 0
72
+ ]
73
+ }
74
+ },
75
+ "7": {
76
+ "class_type": "WanVaceToVideo",
77
+ "inputs": {
78
+ "positive": [
79
+ "5",
80
+ 0
81
+ ],
82
+ "negative": [
83
+ "6",
84
+ 0
85
+ ],
86
+ "vae": [
87
+ "3",
88
+ 0
89
+ ],
90
+ "width": "$width",
91
+ "height": "$height",
92
+ "length": "$length",
93
+ "batch_size": 1,
94
+ "strength": 1.0
95
+ }
96
+ },
97
+ "8": {
98
+ "class_type": "KSampler",
99
+ "inputs": {
100
+ "model": [
101
+ "4",
102
+ 0
103
+ ],
104
+ "seed": "$seed",
105
+ "steps": "$steps",
106
+ "cfg": 5,
107
+ "sampler_name": "uni_pc",
108
+ "scheduler": "simple",
109
+ "positive": [
110
+ "7",
111
+ 0
112
+ ],
113
+ "negative": [
114
+ "7",
115
+ 1
116
+ ],
117
+ "latent_image": [
118
+ "7",
119
+ 2
120
+ ],
121
+ "denoise": 1
122
+ }
123
+ },
124
+ "9": {
125
+ "class_type": "TrimVideoLatent",
126
+ "inputs": {
127
+ "samples": [
128
+ "8",
129
+ 0
130
+ ],
131
+ "trim_amount": [
132
+ "7",
133
+ 3
134
+ ]
135
+ }
136
+ },
137
+ "10": {
138
+ "class_type": "VAEDecode",
139
+ "inputs": {
140
+ "samples": [
141
+ "9",
142
+ 0
143
+ ],
144
+ "vae": [
145
+ "3",
146
+ 0
147
+ ]
148
+ }
149
+ },
150
+ "11": {
151
+ "class_type": "CreateVideo",
152
+ "inputs": {
153
+ "images": [
154
+ "10",
155
+ 0
156
+ ],
157
+ "fps": "$fps"
158
+ }
159
+ },
160
+ "12": {
161
+ "class_type": "SaveVideo",
162
+ "inputs": {
163
+ "video": [
164
+ "11",
165
+ 0
166
+ ],
167
+ "filename_prefix": "lcode/video",
168
+ "format": "mp4",
169
+ "codec": "auto"
170
+ }
171
+ }
172
+ }
173
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lcode-cli
3
- Version: 0.45.0
3
+ Version: 0.47.0
4
4
  Summary: A local-first terminal coding agent powered by open-weight models on your own GPU or Mac, via Ollama.
5
5
  Project-URL: Homepage, https://nasser1941.github.io/lcode/
6
6
  Project-URL: Documentation, https://nasser1941.github.io/lcode/