Bellok commited on
Commit
382376e
Β·
1 Parent(s): 514a289

refactor: simplify system initialization by removing function wrapper

Browse files

Remove the `initialize_system()` function and `@GPU` decorator, moving initialization steps directly into the script body with added progress prints for better readability and streamlined execution.

Files changed (1) hide show
  1. app.py +18 -25
app.py CHANGED
@@ -25,34 +25,27 @@ from warbler_cda.pack_loader import PackLoader
25
  # Initialize the system
26
  print("πŸš€ Initializing Warbler CDA...")
27
 
28
- @GPU
29
- def initialize_system():
30
- """Initialize the Warbler CDA system with GPU support."""
31
- # Create embedding provider (will use sentence-transformers with GPU if available)
32
- embedding_provider = EmbeddingProviderFactory.get_default_provider()
33
- print(f"βœ… Embedding provider: {embedding_provider.get_provider_info()['provider_id']}")
34
-
35
- # Create semantic anchors (required by RetrievalAPI)
36
- semantic_anchors = SemanticAnchorGraph(embedding_provider=embedding_provider)
37
- print("βœ… Semantic anchors initialized")
38
 
39
- # Create FractalStat bridge
40
- fractalstat_bridge = FractalStatRAGBridge()
41
- print("βœ… FractalStat bridge initialized")
42
-
43
- # Create RetrievalAPI with proper components
44
- api = RetrievalAPI(
45
- semantic_anchors=semantic_anchors,
46
- embedding_provider=embedding_provider,
47
- fractalstat_bridge=fractalstat_bridge,
48
- config={"enable_fractalstat_hybrid": True}
49
- )
50
- print("βœ… RetrievalAPI initialized")
51
 
52
- return api
 
 
53
 
54
- # Initialize with GPU support
55
- api = initialize_system()
 
 
 
 
 
 
56
 
57
  # Load packs
58
  print("πŸ“š Loading Warbler packs...")
 
25
  # Initialize the system
26
  print("πŸš€ Initializing Warbler CDA...")
27
 
28
+ # Initialize the system components
29
+ print("βš™οΈ Creating embedding provider...")
30
+ embedding_provider = EmbeddingProviderFactory.get_default_provider()
31
+ print(f"βœ… Embedding provider: {embedding_provider.get_provider_info()['provider_id']}")
 
 
 
 
 
 
32
 
33
+ print("βš™οΈ Initializing semantic anchors...")
34
+ semantic_anchors = SemanticAnchorGraph(embedding_provider=embedding_provider)
35
+ print("βœ… Semantic anchors initialized")
 
 
 
 
 
 
 
 
 
36
 
37
+ print("βš™οΈ Initializing FractalStat bridge...")
38
+ fractalstat_bridge = FractalStatRAGBridge()
39
+ print("βœ… FractalStat bridge initialized")
40
 
41
+ print("βš™οΈ Creating RetrievalAPI...")
42
+ api = RetrievalAPI(
43
+ semantic_anchors=semantic_anchors,
44
+ embedding_provider=embedding_provider,
45
+ fractalstat_bridge=fractalstat_bridge,
46
+ config={"enable_fractalstat_hybrid": True}
47
+ )
48
+ print("βœ… RetrievalAPI initialized")
49
 
50
  # Load packs
51
  print("πŸ“š Loading Warbler packs...")