File size: 5,081 Bytes
6252f54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
"""Streamlit frontend — AMD Enterprise Architecture Strategy Optimizer."""

import sys
import os

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

import streamlit as st
from dotenv import load_dotenv

load_dotenv()

st.set_page_config(
    page_title="AMD EA Optimizer",
    page_icon="⚡",
    layout="wide",
    initial_sidebar_state="expanded",
)

from frontend.utils.api_client import get_health, analyze
from frontend.utils.terminology import TABS
from frontend.components.input_form import render_input_form
from frontend.components.roadmap_tab import render_roadmap_tab
from frontend.components.epics_tab import render_epics_tab
from frontend.components.export_tab import render_export_tab
from frontend.components.training_tab import render_training_tab
from frontend.components.chat_tab import render_chat_tab
from frontend.components.graph_explorer_tab import render_graph_explorer_tab
from frontend.components.integrations_tab import render_integrations_tab


def render_sidebar():
    with st.sidebar:
        # Use local logo for reliability; original URL was 404
        logo_path = os.path.join(os.path.dirname(__file__), "amd_logo.svg")
        st.image(logo_path, width=120)
        st.markdown("## EA Strategy Optimizer")
        st.markdown(
            "Powered by **AMD MI300X · ROCm · Qwen-72B**\n\n"
            "Knowledge Graph → AI Prioritiser → Qwen-72B on AMD MI300X → Compliance Validator"
        )
        st.divider()

        health = get_health()
        status = health.get("status", "unknown")
        color = "green" if status == "ok" else "orange" if status == "degraded" else "red"
        st.markdown(f"**Backend:** :{color}[{status}]")

        gpu = health.get("gpu") or {}
        if gpu.get("available"):
            st.markdown(f"**GPU:** {gpu.get('device', '')}")
            if gpu.get("rocm"):
                st.markdown(f"**ROCm:** {gpu['rocm']}")
        else:
            st.caption("GPU: CPU mode")

        neo4j_status = health.get("neo4j", "unknown")
        neo4j_color = "green" if neo4j_status == "connected" else "red"
        st.markdown(f"**Knowledge Graph:** :{neo4j_color}[{neo4j_status}]")

        st.divider()
        st.markdown(
            "**Track 1 — AI Agents & Agentic Workflows**\n\n"
            "AMD Developer Hackathon 2026\n\n"
            "[GitHub](https://github.com) | [HF Space](https://huggingface.co)"
        )


def main():
    render_sidebar()

    st.title("Enterprise Architecture Strategy Optimizer")
    st.markdown(
        "Transform business goals into **governance-grounded strategic roadmaps** — "
        "with Jira-ready initiatives, business scenarios, and regulatory obligations — "
        "powered by **AMD MI300X**, Knowledge Graph-RAG, and AI-driven prioritisation."
    )

    # ── Tabs — EA Advisor is the landing tab ─────────────────────────────────
    (
        tab_chat,
        tab_graph,
        tab_roadmap,
        tab_epics,
        tab_integrations,
        tab_export,
        tab_training,
    ) = st.tabs(TABS)

    # EA Advisor — always rendered
    with tab_chat:
        render_chat_tab()

    # Graph Explorer — always rendered
    with tab_graph:
        render_graph_explorer_tab()

    # Strategic Roadmap — input form + pipeline results
    with tab_roadmap:
        if "result" not in st.session_state:
            st.session_state["result"] = None

        payload = render_input_form()

        if payload is not None:
            with st.spinner(
                "Running agentic pipeline: "
                "Knowledge Graph → AI Prioritiser → Qwen-72B on AMD MI300X → Compliance Validator…"
            ):
                try:
                    result = analyze(payload)
                    st.session_state["result"] = result
                    st.success("Strategic roadmap generated successfully!")
                except Exception as exc:
                    st.error(f"Pipeline failed: {exc}")

        result = st.session_state.get("result")
        if result:
            render_roadmap_tab(result)
        else:
            st.info(
                "Fill in the Organisation Profile above and click **Generate Strategic Roadmap**, "
                "or use one of the demo scenario buttons."
            )

    with tab_epics:
        result = st.session_state.get("result")
        if result:
            render_epics_tab(result)
        else:
            st.info("Generate a strategic roadmap first to view Initiatives & Scenarios.")

    with tab_integrations:
        result = st.session_state.get("result")
        render_integrations_tab(result)

    with tab_export:
        result = st.session_state.get("result")
        if result:
            render_export_tab(result)
        else:
            st.info("Generate a strategic roadmap first to export.")

    # AI Learning Engine — always rendered
    with tab_training:
        render_training_tab()


if __name__ == "__main__":
    main()