garvitsachdeva Claude Sonnet 4.6 commited on
Commit
b0a7802
·
1 Parent(s): fba2beb

fix: use exec() to run demo app with correct __file__ context

Browse files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. streamlit_app.py +9 -6
streamlit_app.py CHANGED
@@ -1,9 +1,12 @@
1
- import sys
2
  from pathlib import Path
3
 
4
- # Ensure the project root is on sys.path so all local packages are importable
5
- sys.path.insert(0, str(Path(__file__).resolve().parent))
 
6
 
7
- # Entry point delegate to the full demo app
8
- from demo.streamlit_app import main
9
- main()
 
 
 
1
+ import sys, os
2
  from pathlib import Path
3
 
4
+ root = Path(__file__).resolve().parent
5
+ sys.path.insert(0, str(root))
6
+ os.chdir(str(root))
7
 
8
+ demo = root / "demo" / "streamlit_app.py"
9
+ with open(demo, encoding="utf-8") as f:
10
+ code = f.read()
11
+
12
+ exec(compile(code, str(demo), "exec"), {"__file__": str(demo), "__name__": "__main__"})