-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.py
More file actions
31 lines (28 loc) · 1.13 KB
/
Application.py
File metadata and controls
31 lines (28 loc) · 1.13 KB
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
from .services.VideosRepository import VideosRepository
from .services.VideoFolderRepositoryFactory import VideoFolderRepositoryFactory
from .translation.SignLlavaCache import SignLlavaCache
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor
class Application:
"""
Encapsulates all the global services used in the application. This class
instance is enough to use the backend's logic without the HTTP server layer.
It acts as the single point where these services are instantiated and linked
together.
"""
def __init__(
self,
storage_folder: Path
):
storage_folder.mkdir(parents=True, exist_ok=True)
self.videos_repository = VideosRepository(
data_file=storage_folder / "videos.pkl"
)
self.video_folder_repository_factory = VideoFolderRepositoryFactory(
videos_data_folder=storage_folder / "videos_data"
)
self.sign_llava_cache = SignLlavaCache()
self.executor = ThreadPoolExecutor(
max_workers=1
)
"Runs CPU-intensive tasks, such as video processing and LLM execution"