philcuriosity1024's picture
Upload folder using huggingface_hub
670cf0c verified
Raw
History Blame Contribute Delete
671 Bytes
"""钄倄理层ε…₯口"""
from dataclasses import dataclass, field
from typing import List
from PIL import Image
from .scene_classifier import classify_scene, SceneResult
from .image_processor import process
@dataclass
class PreprocessResult:
scene_result: SceneResult
images: List[Image.Image] # εˆ‡η‰‡εŽηš„ε›Ύη‰‡εˆ—θ‘¨
warnings: List[str] = field(default_factory=list)
def run(img: Image.Image, fmt: str) -> PreprocessResult:
scene_result = classify_scene(img, fmt)
result = process(img, scene_result)
return PreprocessResult(
scene_result=scene_result,
images=result["images"],
warnings=result["warnings"],
)