fix(video): declare Pillow runtime floor
This commit is contained in:
@@ -61,6 +61,9 @@ dependencies = [
|
||||
"pyannote-audio>=3.3.2,<4.0",
|
||||
"pyinstaller>=6.19.0",
|
||||
"imageio-ffmpeg>=0.6.0",
|
||||
# Directly used by video_context; 12.1 adds get_flattened_data(), the
|
||||
# replacement for getdata() ahead of its Pillow 14 removal.
|
||||
"pillow>=12.1.0",
|
||||
"pedalboard>=0.9.14",
|
||||
# Primary ASR — cross-platform, CTranslate2-based under the hood. WhisperX
|
||||
# adds wav2vec2 forced alignment (±10-30 ms word timing vs Whisper's own
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"""Pillow-backed video-context analysis stays deterministic across upgrades."""
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from services.video_context import _analyse_frame_basic
|
||||
|
||||
def _analyse(frame_path):
|
||||
module = importlib.import_module("services.video_context")
|
||||
return module._analyse_frame_basic(str(frame_path))
|
||||
|
||||
|
||||
def _save_jpeg(tmp_path, name: str, image: Image.Image):
|
||||
@@ -16,8 +21,8 @@ def test_basic_analysis_decodes_and_resizes_real_jpegs(tmp_path):
|
||||
dark = _save_jpeg(tmp_path, "dark.jpg", Image.new("RGB", (16, 12), (20, 20, 20)))
|
||||
bright = _save_jpeg(tmp_path, "bright.jpg", Image.new("RGB", (640, 480), (230, 230, 230)))
|
||||
|
||||
dark_result = _analyse_frame_basic(str(dark))
|
||||
bright_result = _analyse_frame_basic(str(bright))
|
||||
dark_result = _analyse(dark)
|
||||
bright_result = _analyse(bright)
|
||||
|
||||
assert dark_result == {
|
||||
"brightness": "dark", "mood": "calm", "complexity": "simple",
|
||||
@@ -39,14 +44,14 @@ def test_basic_analysis_preserves_color_and_edge_classes(tmp_path):
|
||||
])
|
||||
action = _save_jpeg(tmp_path, "action.jpg", stripes)
|
||||
|
||||
assert _analyse_frame_basic(str(vivid))["mood"] == "vivid"
|
||||
assert _analyse_frame_basic(str(action))["complexity"] == "action"
|
||||
assert _analyse(vivid)["mood"] == "vivid"
|
||||
assert _analyse(action)["complexity"] == "action"
|
||||
|
||||
|
||||
def test_basic_analysis_degrades_cleanly_for_malformed_image(tmp_path):
|
||||
malformed = tmp_path / "frame.jpg"
|
||||
malformed.write_bytes(b"not an image")
|
||||
|
||||
assert _analyse_frame_basic(str(malformed)) == {
|
||||
assert _analyse(malformed) == {
|
||||
"brightness": "unknown", "mood": "unknown", "complexity": "unknown",
|
||||
}
|
||||
|
||||
@@ -3270,6 +3270,7 @@ dependencies = [
|
||||
{ name = "openai" },
|
||||
{ name = "parakeet-mlx", marker = "platform_machine == 'arm64' and sys_platform == 'darwin'" },
|
||||
{ name = "pedalboard" },
|
||||
{ name = "pillow" },
|
||||
{ name = "pip" },
|
||||
{ name = "posthog" },
|
||||
{ name = "psutil" },
|
||||
@@ -3356,6 +3357,7 @@ requires-dist = [
|
||||
{ name = "openai", specifier = ">=1.40" },
|
||||
{ name = "parakeet-mlx", marker = "platform_machine == 'arm64' and sys_platform == 'darwin'", specifier = ">=0.5.2" },
|
||||
{ name = "pedalboard", specifier = ">=0.9.14" },
|
||||
{ name = "pillow", specifier = ">=12.1.0" },
|
||||
{ name = "pip", specifier = ">=26.1.2" },
|
||||
{ name = "posthog", specifier = ">=3.7" },
|
||||
{ name = "psutil", specifier = ">=7.2.2" },
|
||||
|
||||
Reference in New Issue
Block a user