Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +6 -1
src/streamlit_app.py
CHANGED
|
@@ -17,10 +17,15 @@ except AttributeError:
|
|
| 17 |
|
| 18 |
# --- 1. CONTEXT PROVIDER (Simulated Notion) ---
|
| 19 |
# Use st.cache_data to load the database only once
|
|
|
|
| 20 |
@st.cache_data
|
| 21 |
def load_mock_db():
|
| 22 |
"""Loads the mock database from the JSON file."""
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
return json.load(f)
|
| 25 |
|
| 26 |
notion_data = load_mock_db()
|
|
|
|
| 17 |
|
| 18 |
# --- 1. CONTEXT PROVIDER (Simulated Notion) ---
|
| 19 |
# Use st.cache_data to load the database only once
|
| 20 |
+
|
| 21 |
@st.cache_data
|
| 22 |
def load_mock_db():
|
| 23 |
"""Loads the mock database from the JSON file."""
|
| 24 |
+
# Get the absolute path to the directory where this script is located
|
| 25 |
+
script_dir = os.path.dirname(os.path.abspath(__file__))
|
| 26 |
+
# Join the script's directory path with the filename
|
| 27 |
+
file_path = os.path.join(script_dir, 'mock-notion-db.json')
|
| 28 |
+
with open(file_path, 'r') as f:
|
| 29 |
return json.load(f)
|
| 30 |
|
| 31 |
notion_data = load_mock_db()
|