EZHARDYNAMICS/Sovereign-OneAPI-migration-logic-kernel
0
1import streamlit as st2import plotly.graph_objects as go3import numpy as np4import time5from utils import inject_industrial_css, verify_session, AppConfig6 7st.set_page_config(page_title="TELEMETRY", layout="wide")8inject_industrial_css()9verify_session()10 11st.markdown(f"<h2 style='color:{AppConfig.THEME_COLOR}'>MODULE 03: THERMAL & MEMORY</h2>", unsafe_allow_html=True)12 13# Layout14c1, c2 = st.columns(2)15 16# Generate Mock Data17if 'thermal_history' not in st.session_state:18 st.session_state['thermal_history'] = [45] * 2019 20# Update loop simulation (Manual refresh for demo stability)21new_temp = np.random.normal(55, 5)22st.session_state['thermal_history'].append(new_temp)23st.session_state['thermal_history'].pop(0)24 25with c1:26 st.markdown("#### HBM2e THERMAL ENVELOPE")27 fig = go.Figure()28 29 # Area Chart resembling Heat30 fig.add_trace(go.Scatter(31 y=st.session_state['thermal_history'],32 fill='tozeroy',33 mode='lines',34 line=dict(color=AppConfig.WARNING_COLOR, width=2),35 fillcolor='rgba(255, 215, 0, 0.2)'36 ))37 38 fig.update_layout(39 yaxis=dict(range=[20, 90], title="Celsius"),40 xaxis=dict(showticklabels=False),41 height=300,42 margin=dict(l=20, r=20, t=20, b=20),43 paper_bgcolor='rgba(0,0,0,0)',44 plot_bgcolor='rgba(0,0,0,0)',45 font=dict(color="#ccc")46 )47 st.plotly_chart(fig, use_container_width=True)48 49with c2:50 st.markdown("#### TENSOR CORE UTILIZATION")51 52 # Gauge Chart53 fig_gauge = go.Figure(go.Indicator(54 mode = "gauge+number+delta",55 value = new_temp * 1.5, # Fake utilization56 delta = {'reference': 80},57 gauge = {58 'axis': {'range': [None, 100]},59 'bar': {'color': AppConfig.THEME_COLOR},60 'bgcolor': "#111",61 'borderwidth': 2,62 'bordercolor': "#333",63 'steps': [64 {'range': [0, 60], 'color': '#1f2833'},65 {'range': [60, 90], 'color': '#004060'}],66 }67 ))68 69 fig_gauge.update_layout(70 height=300,71 margin=dict(l=20, r=20, t=30, b=20),72 paper_bgcolor='rgba(0,0,0,0)',73 font=dict(color="#ccc", family="JetBrains Mono")74 )75 st.plotly_chart(fig_gauge, use_container_width=True)76 77col_act, _ = st.columns([1, 4])78with col_act:79 if st.button("REFRESH SENSORS"):80 st.rerun()