import dash
from dash import html
import dash_bootstrap_components as dbc
app = dash.Dash(
__name__,
use_pages=True,
external_stylesheets=[dbc.themes.DARKLY, dbc.icons.BOOTSTRAP],
suppress_callback_exceptions=True,
title="AutoSense - Engine Anomaly Detection",
)
server = app.server
sidebar = html.Div([
html.Div([
html.Div([
html.I(className="bi bi-cpu-fill fs-2", style={"color": "#1d9e75"})
], style={
"width": "45px", "height": "45px",
"display": "flex", "alignItems": "center", "justifyContent": "center",
"background": "rgba(255,255,255,0.05)",
"borderRadius": "12px",
"boxShadow": "0 0 20px rgba(29, 158, 117, 0.3)",
"border": "1px solid rgba(29, 158, 117, 0.2)",
}),
html.Div([
html.H3("AutoSense", className="ms-3 mb-0 fw-bold text-white",
style={"letterSpacing": "2px"}),
html.Small("Engine Anomaly Detection", className="ms-3 text-muted"),
]),
], className="d-flex align-items-center mb-5"),
dbc.Nav([
dbc.NavLink([html.I(className="bi bi-house-door me-3"), "Overview"],
href="/", active="exact", className="mb-2 nav-link-custom"),
dbc.NavLink([html.I(className="bi bi-info-circle me-3"), "The Problem"],
href="/problem", active="exact", className="mb-2 nav-link-custom"),
dbc.NavLink([html.I(className="bi bi-database me-3"), "The Data"],
href="/data", active="exact", className="mb-2 nav-link-custom"),
dbc.NavLink([html.I(className="bi bi-bar-chart-line me-3"), "Model Comparison"],
href="/comparison", active="exact", className="mb-2 nav-link-custom"),
dbc.NavLink([html.I(className="bi bi-activity me-3"), "Anomaly Engine"],
href="/engine", active="exact", className="mb-2 nav-link-custom"),
], vertical=True, pills=True),
html.Div([
html.Hr(style={"borderColor": "rgba(255,255,255,0.1)"}),
html.Small("Autoencoder - 168 params", className="text-muted d-block"),
html.Small("Seat Leon OBD-II", className="text-muted d-block"),
], className="mt-auto pt-4"),
], className="sidebar-container d-flex flex-column")
footer = html.Footer(
dbc.Container(
dbc.Row([
dbc.Col(html.Hr(style={"borderTop": "1px solid rgba(255,255,255,0.1)",
"marginBottom": "20px"}), width=12),
dbc.Col(
html.P([
html.Span("AutoSense ", className="text-info fw-bold"),
html.Span("- unsupervised engine health monitoring with autoencoders.",
className="text-muted"),
], className="small text-center mb-0 pb-3"),
width=12),
]),
fluid=True,
),
style={"marginTop": "auto"},
)
app.layout = html.Div([
html.Div(className="bg-glow"),
sidebar,
html.Div([
dash.page_container,
footer,
], className="content-container d-flex flex-column", style={"minHeight": "100vh"}),
])
if __name__ == "__main__":
app.run(debug=True, port=7860)