-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
48 lines (38 loc) · 1.1 KB
/
app.py
File metadata and controls
48 lines (38 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from __future__ import annotations
import os
import numpy as np
import pandas as pd
import pyvista as pv
from dash import Dash
import dash_bootstrap_components as dbc
from interaction.callbacks import register_callbacks
from visualization.ui import create_layout
from utils.global_app_state import GlobalAppState
from analysis.threshold import Threshold
# -------------------------
# Global state
# -------------------------
global_state = GlobalAppState()
# -------------------------
# Dash app
# -------------------------
app = Dash(
__name__,
external_stylesheets=[dbc.themes.CYBORG],
suppress_callback_exceptions=True, # safer for multi-page / dynamic layouts
)
server = app.server # Required for Hugging Face
app.layout = create_layout()
# Register callbacks
register_callbacks(app, global_state)
# -------------------------
# Run (HF-compatible)
# -------------------------
if __name__ == "__main__":
port = int(os.environ.get("PORT", 7860))
app.run(
host="0.0.0.0", # REQUIRED for HF
port=port,
debug=False, # NEVER True on HF
use_reloader=False
)