-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
46 lines (35 loc) · 1.05 KB
/
Copy pathmain.py
File metadata and controls
46 lines (35 loc) · 1.05 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
"""
Main entry point for CodebookAI application.
This script initializes and runs the CodebookAI text classification application.
"""
import sys
import os
import threading
from settings.models_registry import preload_models
# Add the project root to the Python path
project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)
# Import and run the main UI
import tkinter as tk
# Try to import TkinterDnD for drag-and-drop support
try:
from tkinterdnd2 import TkinterDnD
_HAS_DND = True
except ImportError:
_HAS_DND = False
from ui.main_window import build_ui
def _warm_models_cache():
try:
preload_models()
except Exception:
pass # Non-fatal; Settings will still have the fallback list
if __name__ == "__main__":
threading.Thread(target=_warm_models_cache, daemon=True).start()
# Create root window with drag-and-drop support if available
if _HAS_DND:
root = TkinterDnD.Tk()
else:
root = tk.Tk()
build_ui(root)
root.mainloop()