Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,8 @@ import librosa
|
|
| 6 |
import numpy as np
|
| 7 |
from pydub import AudioSegment
|
| 8 |
from moviepy.editor import AudioFileClip, ImageClip, CompositeVideoClip
|
|
|
|
|
|
|
| 9 |
import subprocess
|
| 10 |
from pathlib import Path
|
| 11 |
import sys
|
|
@@ -117,7 +119,7 @@ def package_and_export(track_folder_str, bpm, start_offset_sec, cover_art):
|
|
| 117 |
make_loop(stems['Piano'], "PianoLoop")
|
| 118 |
make_loop(stems['Vocals'], "VocalChop")
|
| 119 |
|
| 120 |
-
# 3. Generate Video
|
| 121 |
video_path = None
|
| 122 |
if cover_art and created_loops['melody']:
|
| 123 |
print("Rendering Dynamic Noir Video...")
|
|
@@ -132,11 +134,9 @@ def package_and_export(track_folder_str, bpm, start_offset_sec, cover_art):
|
|
| 132 |
# 1. Force Black & White
|
| 133 |
img = img.fx(blackwhite)
|
| 134 |
# 2. Boost Contrast (make the blacks deeper, whites brighter)
|
| 135 |
-
# 'lum' is luminosity (0 for no change), 'contrast' is the multiplier.
|
| 136 |
-
# 1.3 is a 30% contrast boost for that "gritty" look.
|
| 137 |
img = img.fx(lum_contrast, lum=0, contrast=1.3)
|
| 138 |
# ------------------------------------
|
| 139 |
-
|
| 140 |
# Simple Zoom Animation
|
| 141 |
img = img.resize(lambda t : 1 + 0.02*t)
|
| 142 |
img = img.set_position(('center', 'center'))
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
from pydub import AudioSegment
|
| 8 |
from moviepy.editor import AudioFileClip, ImageClip, CompositeVideoClip
|
| 9 |
+
# --- FIX: Import the video effects explicitly ---
|
| 10 |
+
from moviepy.video.fx.all import blackwhite, lum_contrast
|
| 11 |
import subprocess
|
| 12 |
from pathlib import Path
|
| 13 |
import sys
|
|
|
|
| 119 |
make_loop(stems['Piano'], "PianoLoop")
|
| 120 |
make_loop(stems['Vocals'], "VocalChop")
|
| 121 |
|
| 122 |
+
# 3. Generate Video
|
| 123 |
video_path = None
|
| 124 |
if cover_art and created_loops['melody']:
|
| 125 |
print("Rendering Dynamic Noir Video...")
|
|
|
|
| 134 |
# 1. Force Black & White
|
| 135 |
img = img.fx(blackwhite)
|
| 136 |
# 2. Boost Contrast (make the blacks deeper, whites brighter)
|
|
|
|
|
|
|
| 137 |
img = img.fx(lum_contrast, lum=0, contrast=1.3)
|
| 138 |
# ------------------------------------
|
| 139 |
+
|
| 140 |
# Simple Zoom Animation
|
| 141 |
img = img.resize(lambda t : 1 + 0.02*t)
|
| 142 |
img = img.set_position(('center', 'center'))
|