Spaces:
Build error
Build error
File size: 1,359 Bytes
ec6ad2f c13ce0c ec6ad2f a1f4a1e ec6ad2f c13ce0c bb49e0d cf3d6df 9843f6c cf3d6df c13ce0c 943db10 c13ce0c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
from dataclasses import dataclass
import os
from dotenv import load_dotenv
load_dotenv()
@dataclass
class Config:
"""Configuration settings for the comic-to-video pipeline."""
org_input_path: str = ""
input_path: str = ""
current_path = os.path.abspath(os.path.join(os.path.dirname(__file__)))
EPOCH = int(os.getenv('EPOCH', '200'))
YOLO_BASE_MODEL_NAME = os.getenv('YOLO_BASE_MODEL_NAME', 'yolo11s-seg')
yolo_base_model_path: str = f'{current_path}/{YOLO_BASE_MODEL_NAME}.pt'
YOLO_MODEL_NAME = f"{os.getenv('YOLO_MODEL_NAME', 'comic_panel')}_{YOLO_BASE_MODEL_NAME}"
yolo_trained_model_path: str = f'{current_path}/{YOLO_MODEL_NAME}.pt'
black_overlay_input_path: str = ""
output_folder: str = "temp_dir"
distance_threshold: int = 70
vertical_threshold: int = 30
text_cood_file_name: str = "detect_and_group_text.json"
min_text_length: int = 2
min_area_ratio: float = 0.05
min_width_ratio: float = 0.15
min_height_ratio: float = 0.15
# Additional parameters for BorderPanelExtractor
panel_filename_pattern: str = r"panel_\d+_\((\d+), (\d+), (\d+), (\d+)\)\.jpg"
"""Configuration class to manage environment variables and paths."""
DEFAULT_IMAGE_SIZE = 640
SUPPORTED_EXTENSIONS = ['jpg', 'jpeg', 'png', 'JPG', 'JPEG', 'PNG']
def get_text_cood_file_path(config: Config):
return f'{config.output_folder}/{config.text_cood_file_name}' |