| """ |
| Root app.py β HuggingFace Spaces entry point. |
| |
| Delegates directly to visualization/app.py. |
| |
| Run locally : streamlit run app.py |
| HF Spaces : set "app_file: app.py" in README.md front-matter (default) |
| """ |
|
|
| import sys |
| import importlib.util |
| from pathlib import Path |
|
|
| import streamlit as st |
|
|
| ROOT = Path(__file__).resolve().parent |
| APP_DIR = ROOT / "visualization" |
|
|
| |
| st.set_page_config( |
| page_title="Musora Sentiment Analysis", |
| page_icon="π", |
| layout="wide", |
| initial_sidebar_state="expanded", |
| ) |
|
|
| |
| |
| import streamlit as _st_mod |
| _st_mod.set_page_config = lambda *a, **kw: None |
|
|
| |
| app_dir_str = str(APP_DIR) |
| if app_dir_str not in sys.path: |
| sys.path.insert(0, app_dir_str) |
|
|
| |
| spec = importlib.util.spec_from_file_location("_subapp", APP_DIR / "app.py") |
| mod = importlib.util.module_from_spec(spec) |
|
|
| try: |
| spec.loader.exec_module(mod) |
| if hasattr(mod, "main"): |
| mod.main() |
| except Exception as exc: |
| if "Stop" in type(exc).__name__: |
| raise |
| st.error(f"Dashboard error: {exc}") |
| st.exception(exc) |