Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,16 +43,8 @@ GRAPH_CONFIG = {
|
|
| 43 |
"showTips": True,
|
| 44 |
}
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
ROOT = Path(__file__).resolve().parent # /app (Dockerμμ μμ
λλ ν 리)
|
| 50 |
-
DEFAULT_PATH = os.getenv(
|
| 51 |
-
"EXCEL_PATH",
|
| 52 |
-
str(ROOT / "bayesian_analysis_total_v1.xlsx") # λ¦¬ν¬ λ£¨νΈμ μ¬λ¦° νμΌλͺ
|
| 53 |
-
)
|
| 54 |
-
EXCEL_PATH = DEFAULT_PATH # μ½λ μ΄λκ°μμ DEFAULT_PATHλ₯Ό μ¨λ HFμμ μ΄ κ°μ΄ μ μ©λ¨
|
| 55 |
-
|
| 56 |
|
| 57 |
# ===================== λ 벨 μμ =====================
|
| 58 |
LEVEL_OVERALL="μ 체"; LEVEL_SEGMENT="μΈκ·Έλ¨ΌνΈ"; LEVEL_MODEL="λͺ¨λΈ"
|
|
@@ -2308,7 +2300,6 @@ def standardize_top_fig(fig):
|
|
| 2308 |
return fig
|
| 2309 |
|
| 2310 |
# βββββββββββββββββ app.layout κ΅μ²΄ βββββββββββββββββ
|
| 2311 |
-
# βββββββββββββ spacing knobs (ν κ³³μμ μ‘°μ ) βββββββββββββ
|
| 2312 |
ROW_GAP = "16px" # μΉ΄λ μ¬μ΄ κ°κ²©
|
| 2313 |
PAGE_PAD = "24px 28px 24px" # ν μμͺ½ ν¨λ©
|
| 2314 |
CARD_H = "430px" # μΉ΄λ(λ°μ€) λμ΄
|
|
@@ -2318,7 +2309,6 @@ KPI_GAP = "12px" # KPI μΉ΄λ κ°κ²©
|
|
| 2318 |
ROW1_COLS = "1fr 1fr 1fr" # μλ¨ 3μΉ΄λ λμΌ λλΉ
|
| 2319 |
ROW2_COLS = "1fr 1fr 1fr" # νλ¨ 3μΉ΄λ λμΌ λλΉ
|
| 2320 |
|
| 2321 |
-
# βββββββββββββββββ app.layout κ΅μ²΄ βββββββββββββββββ
|
| 2322 |
app.layout = html.Div(
|
| 2323 |
[
|
| 2324 |
dcc.Store(id="store-master"),
|
|
@@ -2407,13 +2397,21 @@ app.layout = html.Div(
|
|
| 2407 |
html.Div(
|
| 2408 |
[
|
| 2409 |
html.Div(
|
| 2410 |
-
dcc.Graph(
|
| 2411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2412 |
),
|
| 2413 |
|
| 2414 |
html.Div(
|
| 2415 |
-
dcc.Graph(
|
| 2416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2417 |
),
|
| 2418 |
|
| 2419 |
html.Div(
|
|
@@ -2426,14 +2424,18 @@ app.layout = html.Div(
|
|
| 2426 |
],
|
| 2427 |
style={"marginBottom":"6px"},
|
| 2428 |
),
|
| 2429 |
-
dcc.Graph(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2430 |
],
|
| 2431 |
-
style={**CARD_STYLE, "height": CARD_H},
|
| 2432 |
),
|
| 2433 |
],
|
| 2434 |
style={
|
| 2435 |
"display":"grid",
|
| 2436 |
-
"gridTemplateColumns": ROW1_COLS,
|
| 2437 |
"gap": ROW_GAP,
|
| 2438 |
"padding": PAGE_PAD,
|
| 2439 |
"marginBottom":"22px",
|
|
@@ -2457,18 +2459,30 @@ app.layout = html.Div(
|
|
| 2457 |
],
|
| 2458 |
style={"display":"flex","justifyContent":"flex-end","alignItems":"center","marginBottom":"6px"},
|
| 2459 |
),
|
| 2460 |
-
dcc.Graph(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2461 |
],
|
| 2462 |
style={**CARD_STYLE, "height": CARD_H, "overflow":"hidden"},
|
| 2463 |
),
|
| 2464 |
|
| 2465 |
html.Div(
|
| 2466 |
-
dcc.Graph(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2467 |
style={**CARD_STYLE, "height": CARD_H, "overflow":"hidden"}
|
| 2468 |
),
|
| 2469 |
|
| 2470 |
html.Div(
|
| 2471 |
-
dcc.Graph(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2472 |
style={**CARD_STYLE, "height": CARD_H, "overflow":"hidden"}
|
| 2473 |
),
|
| 2474 |
],
|
|
@@ -2484,8 +2498,8 @@ app.layout = html.Div(
|
|
| 2484 |
# μ¨κΉ κ·Έλν
|
| 2485 |
html.Div(
|
| 2486 |
[
|
| 2487 |
-
dcc.Graph(id="fig-survival", config=GRAPH_CONFIG),
|
| 2488 |
-
dcc.Graph(id="fig-funnel", config=GRAPH_CONFIG),
|
| 2489 |
],
|
| 2490 |
style={"display":"none"},
|
| 2491 |
),
|
|
@@ -2899,14 +2913,15 @@ def update_all(seg, mod, loy, drag_val, stage_label, tab_right,
|
|
| 2899 |
empty, empty, empty, empty, empty, empty, empty, empty
|
| 2900 |
)
|
| 2901 |
|
| 2902 |
-
#
|
| 2903 |
if __name__ == "__main__":
|
| 2904 |
-
|
| 2905 |
-
|
| 2906 |
-
|
| 2907 |
-
|
| 2908 |
-
|
| 2909 |
-
|
| 2910 |
-
|
| 2911 |
-
|
|
|
|
| 2912 |
|
|
|
|
| 43 |
"showTips": True,
|
| 44 |
}
|
| 45 |
|
| 46 |
+
# ===================== κΈ°λ³Έ κ²½λ‘ =====================
|
| 47 |
+
DEFAULT_PATH = r"/content/drive/MyDrive/baye_dash/bayesian_analysis_total_v1.xlsx"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
# ===================== λ 벨 μμ =====================
|
| 50 |
LEVEL_OVERALL="μ 체"; LEVEL_SEGMENT="μΈκ·Έλ¨ΌνΈ"; LEVEL_MODEL="λͺ¨λΈ"
|
|
|
|
| 2300 |
return fig
|
| 2301 |
|
| 2302 |
# βββββββββββββββββ app.layout κ΅μ²΄ βββββββββββββββββ
|
|
|
|
| 2303 |
ROW_GAP = "16px" # μΉ΄λ μ¬μ΄ κ°κ²©
|
| 2304 |
PAGE_PAD = "24px 28px 24px" # ν μμͺ½ ν¨λ©
|
| 2305 |
CARD_H = "430px" # μΉ΄λ(λ°μ€) λμ΄
|
|
|
|
| 2309 |
ROW1_COLS = "1fr 1fr 1fr" # μλ¨ 3μΉ΄λ λμΌ λλΉ
|
| 2310 |
ROW2_COLS = "1fr 1fr 1fr" # νλ¨ 3μΉ΄λ λμΌ λλΉ
|
| 2311 |
|
|
|
|
| 2312 |
app.layout = html.Div(
|
| 2313 |
[
|
| 2314 |
dcc.Store(id="store-master"),
|
|
|
|
| 2397 |
html.Div(
|
| 2398 |
[
|
| 2399 |
html.Div(
|
| 2400 |
+
dcc.Graph(
|
| 2401 |
+
id="fig-sankey",
|
| 2402 |
+
config=GRAPH_CONFIG | {"responsive": True},
|
| 2403 |
+
style={"height": GRAPH_H, "width": "100%"}
|
| 2404 |
+
),
|
| 2405 |
+
style={**CARD_STYLE, "height": CARD_H, "overflow": "hidden"} # β κ³ μ /ν΄λ¦½
|
| 2406 |
),
|
| 2407 |
|
| 2408 |
html.Div(
|
| 2409 |
+
dcc.Graph(
|
| 2410 |
+
id="fig-matrix",
|
| 2411 |
+
config=GRAPH_CONFIG | {"responsive": True},
|
| 2412 |
+
style={"height": GRAPH_H, "width": "100%"}
|
| 2413 |
+
),
|
| 2414 |
+
style={**CARD_STYLE, "height": CARD_H, "overflow": "hidden"}
|
| 2415 |
),
|
| 2416 |
|
| 2417 |
html.Div(
|
|
|
|
| 2424 |
],
|
| 2425 |
style={"marginBottom":"6px"},
|
| 2426 |
),
|
| 2427 |
+
dcc.Graph(
|
| 2428 |
+
id="fig-right",
|
| 2429 |
+
config=GRAPH_CONFIG | {"responsive": True},
|
| 2430 |
+
style={"height": GRAPH_H, "width": "100%"}
|
| 2431 |
+
),
|
| 2432 |
],
|
| 2433 |
+
style={**CARD_STYLE, "height": CARD_H, "overflow": "hidden"},
|
| 2434 |
),
|
| 2435 |
],
|
| 2436 |
style={
|
| 2437 |
"display":"grid",
|
| 2438 |
+
"gridTemplateColumns": ROW1_COLS,
|
| 2439 |
"gap": ROW_GAP,
|
| 2440 |
"padding": PAGE_PAD,
|
| 2441 |
"marginBottom":"22px",
|
|
|
|
| 2459 |
],
|
| 2460 |
style={"display":"flex","justifyContent":"flex-end","alignItems":"center","marginBottom":"6px"},
|
| 2461 |
),
|
| 2462 |
+
dcc.Graph(
|
| 2463 |
+
id="fig-stage-rank",
|
| 2464 |
+
config=GRAPH_CONFIG | {"responsive": True},
|
| 2465 |
+
style={"height": GRAPH_H, "width": "100%"}
|
| 2466 |
+
),
|
| 2467 |
],
|
| 2468 |
style={**CARD_STYLE, "height": CARD_H, "overflow":"hidden"},
|
| 2469 |
),
|
| 2470 |
|
| 2471 |
html.Div(
|
| 2472 |
+
dcc.Graph(
|
| 2473 |
+
id="fig-forest",
|
| 2474 |
+
config=GRAPH_CONFIG | {"responsive": True},
|
| 2475 |
+
style={"height": GRAPH_H, "width": "100%"}
|
| 2476 |
+
),
|
| 2477 |
style={**CARD_STYLE, "height": CARD_H, "overflow":"hidden"}
|
| 2478 |
),
|
| 2479 |
|
| 2480 |
html.Div(
|
| 2481 |
+
dcc.Graph(
|
| 2482 |
+
id="fig-bubble",
|
| 2483 |
+
config=GRAPH_CONFIG | {"responsive": True},
|
| 2484 |
+
style={"height": GRAPH_H, "width": "100%"}
|
| 2485 |
+
),
|
| 2486 |
style={**CARD_STYLE, "height": CARD_H, "overflow":"hidden"}
|
| 2487 |
),
|
| 2488 |
],
|
|
|
|
| 2498 |
# μ¨κΉ κ·Έλν
|
| 2499 |
html.Div(
|
| 2500 |
[
|
| 2501 |
+
dcc.Graph(id="fig-survival", config=GRAPH_CONFIG, style={"height": GRAPH_H}),
|
| 2502 |
+
dcc.Graph(id="fig-funnel", config=GRAPH_CONFIG, style={"height": GRAPH_H}),
|
| 2503 |
],
|
| 2504 |
style={"display":"none"},
|
| 2505 |
),
|
|
|
|
| 2913 |
empty, empty, empty, empty, empty, empty, empty, empty
|
| 2914 |
)
|
| 2915 |
|
| 2916 |
+
# ===================== μ€ν =====================
|
| 2917 |
if __name__ == "__main__":
|
| 2918 |
+
base_port = int(os.getenv("PORT", "8059"))
|
| 2919 |
+
for i in range(5):
|
| 2920 |
+
try:
|
| 2921 |
+
app.run_server(host="0.0.0.0", port=base_port + i, debug=False, use_reloader=False)
|
| 2922 |
+
break
|
| 2923 |
+
except (OSError, SystemExit) as e:
|
| 2924 |
+
if "Address already in use" in str(e) or getattr(e, "code", None) == 1:
|
| 2925 |
+
continue
|
| 2926 |
+
raise
|
| 2927 |
|