FerrellSyntheticIntelligence commited on
Commit
0193f9d
·
1 Parent(s): 03e0e37

fix: resolve directory structure and lazy import logic

Browse files
Files changed (2) hide show
  1. app.py +5 -9
  2. src/core/memory_engine.py +6 -0
app.py CHANGED
@@ -1,16 +1,12 @@
1
- import sys
2
  import subprocess
 
3
 
4
- # 1. Force installation before any imports occur
5
- try:
6
- import faiss
7
- except ImportError:
8
- print("Installing faiss-cpu...")
9
- subprocess.check_call([sys.executable, "-m", "pip", "install", "faiss-cpu"])
10
- import faiss
11
 
12
- # 2. Now it is safe to import your engine
13
  from src.core.memory_engine import MemoryEngine
14
 
15
  if __name__ == "__main__":
 
16
  print("Engine initialized successfully.")
 
 
1
  import subprocess
2
+ import sys
3
 
4
+ print("Ensuring dependencies...")
5
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "faiss-cpu"])
 
 
 
 
 
6
 
7
+ # Now import the class
8
  from src.core.memory_engine import MemoryEngine
9
 
10
  if __name__ == "__main__":
11
+ engine = MemoryEngine()
12
  print("Engine initialized successfully.")
src/core/memory_engine.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ class MemoryEngine:
2
+ def __init__(self):
3
+ print("Initializing MemoryEngine...")
4
+ import faiss
5
+ self.faiss = faiss
6
+ print("FAISS loaded successfully.")