peppinob-ol commited on
Commit
79e7093
·
1 Parent(s): 166316e

Fix multi-page structure for Streamlit

Browse files
Files changed (1) hide show
  1. app_hf.py +12 -15
app_hf.py CHANGED
@@ -1,26 +1,23 @@
1
  """
2
  Entry point for Hugging Face Spaces deployment
3
- Redirects to the main Streamlit app in eda/app.py
4
  """
5
 
6
  import sys
 
7
  from pathlib import Path
8
 
9
- # Add project root to path
10
- project_root = Path(__file__).parent
11
- if str(project_root) not in sys.path:
12
- sys.path.insert(0, str(project_root))
13
 
14
- # Import and run the main app
15
- # This allows the app to work both locally and on HF Spaces
16
- # without modifying the original eda/app.py structure
17
 
18
- # Change to eda directory context
19
- import os
20
- os.chdir(project_root)
21
-
22
- # Import the main app module
23
- from eda import app
24
 
25
- # The streamlit app will be executed automatically when this module is loaded
 
26
 
 
1
  """
2
  Entry point for Hugging Face Spaces deployment
3
+ This is a simple wrapper that runs the Streamlit app from the eda directory
4
  """
5
 
6
  import sys
7
+ import os
8
  from pathlib import Path
9
 
10
+ # Get the eda directory path
11
+ eda_dir = Path(__file__).parent / "eda"
 
 
12
 
13
+ # Change to eda directory so Streamlit can find pages/ folder
14
+ os.chdir(eda_dir)
 
15
 
16
+ # Add both project root and eda to path
17
+ project_root = Path(__file__).parent
18
+ sys.path.insert(0, str(project_root))
19
+ sys.path.insert(0, str(eda_dir))
 
 
20
 
21
+ # Now import and run the app
22
+ import app
23