Spaces:
Sleeping
Sleeping
Update pipeline/generator.py
Browse files- pipeline/generator.py +4 -4
pipeline/generator.py
CHANGED
|
@@ -486,7 +486,7 @@ class VideoGenerationPipeline:
|
|
| 486 |
Mode Director : topic → storyboard auto → génération scène par scène → assemblage.
|
| 487 |
Crée une vidéo longue et cohérente automatiquement.
|
| 488 |
"""
|
| 489 |
-
|
| 490 |
|
| 491 |
storyboard = PromptEnhancer.auto_storyboard(topic, n_scenes)
|
| 492 |
clips = []
|
|
@@ -506,12 +506,12 @@ class VideoGenerationPipeline:
|
|
| 506 |
)
|
| 507 |
result = self.generate(scene_cfg)
|
| 508 |
if result.success and result.video_path:
|
| 509 |
-
clips.append(
|
| 510 |
|
| 511 |
if not clips:
|
| 512 |
raise RuntimeError("Aucune scène générée")
|
| 513 |
|
| 514 |
-
final =
|
| 515 |
out_path = OUTPUT_DIR / f"director_{int(time.time())}.mp4"
|
| 516 |
final.write_videofile(str(out_path), fps=config.fps, codec="libx264",
|
| 517 |
audio_codec="aac", logger=None)
|
|
@@ -532,4 +532,4 @@ class VideoGenerationPipeline:
|
|
| 532 |
gc.collect()
|
| 533 |
if torch.cuda.is_available():
|
| 534 |
torch.cuda.empty_cache()
|
| 535 |
-
torch.cuda.synchronize()
|
|
|
|
| 486 |
Mode Director : topic → storyboard auto → génération scène par scène → assemblage.
|
| 487 |
Crée une vidéo longue et cohérente automatiquement.
|
| 488 |
"""
|
| 489 |
+
from moviepy import VideoFileClip, concatenate_videoclips
|
| 490 |
|
| 491 |
storyboard = PromptEnhancer.auto_storyboard(topic, n_scenes)
|
| 492 |
clips = []
|
|
|
|
| 506 |
)
|
| 507 |
result = self.generate(scene_cfg)
|
| 508 |
if result.success and result.video_path:
|
| 509 |
+
clips.append(VideoFileClip(result.video_path))
|
| 510 |
|
| 511 |
if not clips:
|
| 512 |
raise RuntimeError("Aucune scène générée")
|
| 513 |
|
| 514 |
+
final = concatenate_videoclips(clips, method="compose")
|
| 515 |
out_path = OUTPUT_DIR / f"director_{int(time.time())}.mp4"
|
| 516 |
final.write_videofile(str(out_path), fps=config.fps, codec="libx264",
|
| 517 |
audio_codec="aac", logger=None)
|
|
|
|
| 532 |
gc.collect()
|
| 533 |
if torch.cuda.is_available():
|
| 534 |
torch.cuda.empty_cache()
|
| 535 |
+
torch.cuda.synchronize()
|