vibe-aigc 0.6.1__py3-none-any.whl → 0.6.2__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.
vibe_aigc/vibe_backend.py CHANGED
@@ -150,6 +150,10 @@ class VibeBackend:
150
150
  import random
151
151
  request.seed = random.randint(0, 2**32 - 1)
152
152
 
153
+ # Special handling for TEXT_TO_VIDEO: use I2V pipeline
154
+ if request.capability == Capability.TEXT_TO_VIDEO:
155
+ return await self._generate_video_via_i2v(request)
156
+
153
157
  # Try to get workflow
154
158
  workflow = await self._get_workflow(request)
155
159
  if not workflow:
@@ -388,6 +392,199 @@ class VibeBackend:
388
392
  except Exception as e:
389
393
  return GenerationResult(success=False, error=str(e))
390
394
 
395
+ async def _generate_video_via_i2v(self, request: GenerationRequest) -> GenerationResult:
396
+ """Generate video via Image-to-Video pipeline.
397
+
398
+ Two-step process:
399
+ 1. Generate base image with TEXT_TO_IMAGE
400
+ 2. Animate with IMAGE_TO_VIDEO
401
+ """
402
+ print("\n[1/2] Generating base image...")
403
+
404
+ # Step 1: Generate image
405
+ image_workflow = self._create_flux_image_workflow(
406
+ prompt=request.prompt,
407
+ negative=request.negative_prompt,
408
+ width=request.width,
409
+ height=request.height,
410
+ seed=request.seed
411
+ )
412
+
413
+ image_result = await self._execute_workflow(image_workflow)
414
+ if not image_result.success:
415
+ return GenerationResult(
416
+ success=False,
417
+ error=f"Image generation failed: {image_result.error}"
418
+ )
419
+
420
+ print(f" Base image: {image_result.output_path}")
421
+
422
+ # Step 2: Upload image and animate
423
+ print("\n[2/2] Animating with I2V...")
424
+
425
+ # Download image
426
+ async with aiohttp.ClientSession() as session:
427
+ async with session.get(image_result.output_url) as resp:
428
+ image_data = await resp.read()
429
+
430
+ # Upload to ComfyUI
431
+ form = aiohttp.FormData()
432
+ form.add_field('image', image_data, filename='input.png', content_type='image/png')
433
+
434
+ async with session.post(f"{self.url}/upload/image", data=form) as resp:
435
+ upload_result = await resp.json()
436
+ uploaded_name = upload_result.get("name", "input.png")
437
+ print(f" Uploaded: {uploaded_name}")
438
+
439
+ # Create I2V workflow
440
+ i2v_workflow = self._create_wan_i2v_workflow(
441
+ uploaded_image=uploaded_name,
442
+ prompt=request.prompt,
443
+ negative=request.negative_prompt,
444
+ width=request.width,
445
+ height=request.height,
446
+ frames=request.frames,
447
+ seed=request.seed
448
+ )
449
+
450
+ video_result = await self._execute_workflow(i2v_workflow)
451
+ if not video_result.success:
452
+ return GenerationResult(
453
+ success=False,
454
+ error=f"Animation failed: {video_result.error}"
455
+ )
456
+
457
+ print(f" Video: {video_result.output_path}")
458
+ return video_result
459
+
460
+ def _create_flux_image_workflow(
461
+ self, prompt: str, negative: str, width: int, height: int, seed: int
462
+ ) -> Dict[str, Any]:
463
+ """Create FLUX image generation workflow."""
464
+ return {
465
+ "1": {
466
+ "class_type": "CheckpointLoaderSimple",
467
+ "inputs": {"ckpt_name": "flux1-dev-fp8.safetensors"}
468
+ },
469
+ "2": {
470
+ "class_type": "CLIPTextEncode",
471
+ "inputs": {"text": prompt, "clip": ["1", 1]}
472
+ },
473
+ "3": {
474
+ "class_type": "CLIPTextEncode",
475
+ "inputs": {"text": negative or "blurry, distorted, ugly", "clip": ["1", 1]}
476
+ },
477
+ "4": {
478
+ "class_type": "EmptyLatentImage",
479
+ "inputs": {"width": width, "height": height, "batch_size": 1}
480
+ },
481
+ "5": {
482
+ "class_type": "KSampler",
483
+ "inputs": {
484
+ "seed": seed,
485
+ "steps": 20,
486
+ "cfg": 3.5,
487
+ "sampler_name": "euler",
488
+ "scheduler": "simple",
489
+ "denoise": 1.0,
490
+ "model": ["1", 0],
491
+ "positive": ["2", 0],
492
+ "negative": ["3", 0],
493
+ "latent_image": ["4", 0]
494
+ }
495
+ },
496
+ "6": {
497
+ "class_type": "VAEDecode",
498
+ "inputs": {"samples": ["5", 0], "vae": ["1", 2]}
499
+ },
500
+ "7": {
501
+ "class_type": "SaveImage",
502
+ "inputs": {"images": ["6", 0], "filename_prefix": "vibe_base"}
503
+ }
504
+ }
505
+
506
+ def _create_wan_i2v_workflow(
507
+ self, uploaded_image: str, prompt: str, negative: str,
508
+ width: int, height: int, frames: int, seed: int
509
+ ) -> Dict[str, Any]:
510
+ """Create Wan 2.1 I2V workflow."""
511
+ return {
512
+ "1": {
513
+ "class_type": "UNETLoader",
514
+ "inputs": {
515
+ "unet_name": "I2V/Wan2_1-I2V-14B-480p_fp8_e4m3fn_scaled_KJ.safetensors",
516
+ "weight_dtype": "fp8_e4m3fn"
517
+ }
518
+ },
519
+ "2": {
520
+ "class_type": "CLIPLoader",
521
+ "inputs": {
522
+ "clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
523
+ "type": "wan"
524
+ }
525
+ },
526
+ "3": {
527
+ "class_type": "VAELoader",
528
+ "inputs": {"vae_name": "wan_2.1_vae.safetensors"}
529
+ },
530
+ "4": {
531
+ "class_type": "LoadImage",
532
+ "inputs": {"image": uploaded_image}
533
+ },
534
+ "5": {
535
+ "class_type": "CLIPTextEncode",
536
+ "inputs": {"text": prompt + ", smooth motion, cinematic", "clip": ["2", 0]}
537
+ },
538
+ "6": {
539
+ "class_type": "CLIPTextEncode",
540
+ "inputs": {"text": negative or "static, frozen, blurry, distorted", "clip": ["2", 0]}
541
+ },
542
+ "7": {
543
+ "class_type": "WanImageToVideo",
544
+ "inputs": {
545
+ "positive": ["5", 0],
546
+ "negative": ["6", 0],
547
+ "vae": ["3", 0],
548
+ "width": width,
549
+ "height": height,
550
+ "length": frames,
551
+ "batch_size": 1,
552
+ "start_image": ["4", 0]
553
+ }
554
+ },
555
+ "8": {
556
+ "class_type": "KSampler",
557
+ "inputs": {
558
+ "seed": seed,
559
+ "steps": 30,
560
+ "cfg": 5.0,
561
+ "sampler_name": "euler",
562
+ "scheduler": "normal",
563
+ "denoise": 1.0,
564
+ "model": ["1", 0],
565
+ "positive": ["7", 0],
566
+ "negative": ["7", 1],
567
+ "latent_image": ["7", 2]
568
+ }
569
+ },
570
+ "9": {
571
+ "class_type": "VAEDecode",
572
+ "inputs": {"samples": ["8", 0], "vae": ["3", 0]}
573
+ },
574
+ "10": {
575
+ "class_type": "VHS_VideoCombine",
576
+ "inputs": {
577
+ "images": ["9", 0],
578
+ "frame_rate": 16,
579
+ "loop_count": 0,
580
+ "filename_prefix": "vibe_i2v",
581
+ "format": "image/webp",
582
+ "pingpong": False,
583
+ "save_output": True
584
+ }
585
+ }
586
+ }
587
+
391
588
  def status(self) -> str:
392
589
  """Get backend status."""
393
590
  if not self._initialized:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vibe-aigc
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: A New Paradigm for Content Generation via Agentic Orchestration
5
5
  Author: Vibe AIGC Contributors
6
6
  License-Expression: MIT
@@ -18,7 +18,7 @@ vibe_aigc/persistence.py,sha256=inrJQjmCK4LighxQSmJorR6c7OvRzx-cmEb5HCQS9PY,1061
18
18
  vibe_aigc/planner.py,sha256=hmnASmofpahNuF9ei_0DxzHxm23vYjF67u-SB_G5EcU,33129
19
19
  vibe_aigc/tools.py,sha256=Tm_NA53yJjjvCrUuZ7YVtdLAdfUgxOLm5zZzIcJYvHI,15572
20
20
  vibe_aigc/tools_multimodal.py,sha256=asSJJqF0hrD9uNiYpuieVY-lbgEXjbK3UjT20nX2Lig,20405
21
- vibe_aigc/vibe_backend.py,sha256=RhiG7LRU3rvbW4x002tJ_4pYX_i2Nwz4QDmP5RksP0k,16610
21
+ vibe_aigc/vibe_backend.py,sha256=LUm9t3JeGfezJTjau9XAQeRN_DmHrPX2PCjNRhGE4lQ,23808
22
22
  vibe_aigc/video.py,sha256=0fg8RUpEsaJqDskAPiGP8yuyQDVCUvIy-uLScq_BOwg,14111
23
23
  vibe_aigc/visualization.py,sha256=jDs2f1vj4k8ZnJTA_niKLBH2NMahTgWneiADlNmW24s,7143
24
24
  vibe_aigc/vlm_feedback.py,sha256=Da26q5qmJr-vwdsstum8CTAjbedeLWAGxZfla2BS0Ko,10781
@@ -28,9 +28,9 @@ vibe_aigc/workflow_executor.py,sha256=mfYLOTfPmI7Upooxy07nPmlbZ-HZAfC18IaNW80G31
28
28
  vibe_aigc/workflow_registry.py,sha256=Z6gB1cA366LXqHcfqBF1od_8ySxAOt5RpKKaaZPqqUo,22359
29
29
  vibe_aigc/workflow_strategies.py,sha256=i_qqUrn-2F6lT9dNyFdTdy0NzE8ZnRNxAMl6zrOAtD8,26148
30
30
  vibe_aigc/workflows.py,sha256=uk7RjNVow6eimEdqfVQFDtLgHSkg0LUjSoa2N7C47u0,13886
31
- vibe_aigc-0.6.1.dist-info/licenses/LICENSE,sha256=Ir4dCTvOsbfoiOh9vYbhIKDH59S7J6qhJYZmHHICoKY,1079
32
- vibe_aigc-0.6.1.dist-info/METADATA,sha256=X3gmW_JWtW65vqnlS5HhM79K1-72Qz0cUxzl3KiFVmg,6604
33
- vibe_aigc-0.6.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
34
- vibe_aigc-0.6.1.dist-info/entry_points.txt,sha256=2htp4yXJMvCAQXTB39XWWwbBPP3MYUYXsqlwMeQsd7o,49
35
- vibe_aigc-0.6.1.dist-info/top_level.txt,sha256=Cpjz8X0WEhnhaigqxmsZSl9VxduaDspj7WuVUGGLeao,10
36
- vibe_aigc-0.6.1.dist-info/RECORD,,
31
+ vibe_aigc-0.6.2.dist-info/licenses/LICENSE,sha256=Ir4dCTvOsbfoiOh9vYbhIKDH59S7J6qhJYZmHHICoKY,1079
32
+ vibe_aigc-0.6.2.dist-info/METADATA,sha256=Tdhh5kFrhVvnvWNe3MkcXwrTW7FL_0w4rZ15rtmar34,6604
33
+ vibe_aigc-0.6.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
34
+ vibe_aigc-0.6.2.dist-info/entry_points.txt,sha256=2htp4yXJMvCAQXTB39XWWwbBPP3MYUYXsqlwMeQsd7o,49
35
+ vibe_aigc-0.6.2.dist-info/top_level.txt,sha256=Cpjz8X0WEhnhaigqxmsZSl9VxduaDspj7WuVUGGLeao,10
36
+ vibe_aigc-0.6.2.dist-info/RECORD,,