Spaces:
Running
Running
thenativefox
commited on
Commit
·
01a0078
1
Parent(s):
a7432c6
attempt3
Browse files- backend/semantic_search.py +15 -0
backend/semantic_search.py
CHANGED
@@ -14,8 +14,23 @@ logger = logging.getLogger(__name__)
|
|
14 |
load_dotenv()
|
15 |
|
16 |
# Connect to the LanceDB database
|
|
|
17 |
current_working_dir = Path(os.getcwd())
|
18 |
logger.info(f"Working directory: {current_working_dir}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
db_path = current_working_dir / "gradio_app" / ".lancedb"
|
20 |
logger.info(f"Database path: {db_path}")
|
21 |
db = lancedb.connect(db_path)
|
|
|
14 |
load_dotenv()
|
15 |
|
16 |
# Connect to the LanceDB database
|
17 |
+
# Determine the working directory
|
18 |
current_working_dir = Path(os.getcwd())
|
19 |
logger.info(f"Working directory: {current_working_dir}")
|
20 |
+
|
21 |
+
# List contents of the current working directory
|
22 |
+
current_dir_contents = os.listdir(current_working_dir)
|
23 |
+
logger.info(f"Contents of the working directory: {current_dir_contents}")
|
24 |
+
|
25 |
+
# Ensure the working directory contains 'gradio_app'
|
26 |
+
if 'gradio_app' not in current_dir_contents:
|
27 |
+
raise FileNotFoundError("The 'gradio_app' directory is missing from the working directory.")
|
28 |
+
|
29 |
+
# List and log all contents of the gradio_app directory
|
30 |
+
gradio_app_dir = current_working_dir / 'gradio_app'
|
31 |
+
gradio_app_contents = os.listdir(gradio_app_dir)
|
32 |
+
logger.info(f"Contents of 'gradio_app' directory: {gradio_app_contents}")
|
33 |
+
|
34 |
db_path = current_working_dir / "gradio_app" / ".lancedb"
|
35 |
logger.info(f"Database path: {db_path}")
|
36 |
db = lancedb.connect(db_path)
|