MogensR commited on
Commit
ef6975e
·
1 Parent(s): 6a8b0ae

Update utils/__init__.py

Browse files
Files changed (1) hide show
  1. utils/__init__.py +0 -67
utils/__init__.py CHANGED
@@ -1,67 +0,0 @@
1
- """
2
- Fixed utils/__init__.py - Properly imports existing functions from utils modules
3
- Replaces the recursive lazy-loading approach with direct imports
4
- """
5
- from __future__ import annotations
6
- import logging
7
- from typing import Any
8
-
9
- logger = logging.getLogger(__name__)
10
-
11
- # Import all required functions from their actual locations in the utils package
12
- try:
13
- from .cv_processing import (
14
- segment_person_hq,
15
- refine_mask_hq,
16
- replace_background_hq,
17
- PROFESSIONAL_BACKGROUNDS
18
- )
19
- logger.debug("Successfully imported cv_processing functions")
20
- except ImportError as e:
21
- logger.error(f"Failed to import cv_processing functions: {e}")
22
- # Provide fallback implementations
23
- def segment_person_hq(*args, **kwargs):
24
- raise NotImplementedError("segment_person_hq not available")
25
- def refine_mask_hq(*args, **kwargs):
26
- raise NotImplementedError("refine_mask_hq not available")
27
- def replace_background_hq(*args, **kwargs):
28
- raise NotImplementedError("replace_background_hq not available")
29
- PROFESSIONAL_BACKGROUNDS = {}
30
-
31
- try:
32
- from .utils import (
33
- validate_video_file,
34
- )
35
- logger.debug("Successfully imported utils functions")
36
- except ImportError as e:
37
- logger.error(f"Failed to import utils functions: {e}")
38
- def validate_video_file(*args, **kwargs):
39
- raise NotImplementedError("validate_video_file not available")
40
-
41
- try:
42
- from .cv_processing import create_professional_background
43
- logger.debug("Successfully imported create_professional_background")
44
- except ImportError:
45
- try:
46
- from .utils import create_professional_background
47
- logger.debug("Successfully imported create_professional_background from utils")
48
- except ImportError as e:
49
- logger.error(f"Failed to import create_professional_background: {e}")
50
- def create_professional_background(*args, **kwargs):
51
- raise NotImplementedError("create_professional_background not available")
52
-
53
- # Export all functions for backward compatibility
54
- __all__ = [
55
- "segment_person_hq",
56
- "refine_mask_hq",
57
- "replace_background_hq",
58
- "create_professional_background",
59
- "PROFESSIONAL_BACKGROUNDS",
60
- "validate_video_file"
61
- ]
62
-
63
- # For backward compatibility with utilities import
64
- import sys
65
- sys.modules["utilities"] = sys.modules[__name__]
66
-
67
- logger.info("Utils module initialized successfully")