mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 21:29:08 +00:00
- Main.py was becoming too big to manage. It had both controllers/routers and component configurations (search, processors) in it - Now that the native app GUI code is also getting added to the main path, good time to split/modularize/clean main.py - Put global state into a separate file to share across modules
20 lines
580 B
Python
20 lines
580 B
Python
# External Packages
|
|
import torch
|
|
from pathlib import Path
|
|
|
|
# Internal Packages
|
|
from src.utils.config import SearchModels, ProcessorConfigModel
|
|
from src.utils.rawconfig import FullConfig
|
|
|
|
# Application Global State
|
|
config = FullConfig()
|
|
model = SearchModels()
|
|
processor_config = ProcessorConfigModel()
|
|
config_file: Path = ""
|
|
verbose: int = 0
|
|
device = torch.device("cuda:0") if torch.cuda.is_available() else torch.device("cpu") # Set device to GPU if available
|
|
|
|
# Other Constants
|
|
web_directory = Path(__file__).parent.parent / 'interface/web/'
|
|
empty_escape_sequences = r'\n|\r\t '
|