| import streamlit as st |
| import plotly.graph_objects as go |
| import pandas as pd |
| import numpy as np |
| import time |
|
|
| |
| st.set_page_config(page_title="OdiHome Wi-Fi Radar", layout="wide") |
| st.title("🛰️ OdiHome: Wi-Fi Spatial Radar") |
| st.markdown("Monitoring human movement via signal variance...") |
|
|
| |
| def get_radar_data(): |
| |
| |
| intensity = np.random.uniform(0, 10) |
| angle = np.random.randint(0, 360) |
| return angle, intensity |
|
|
| |
| placeholder = st.empty() |
|
|
| while True: |
| angle, intensity = get_radar_data() |
| |
| |
| fig = go.Figure() |
|
|
| |
| fig.add_trace(go.Scatterpolar( |
| r=[0, 10], theta=[angle, angle], |
| mode='lines', line=dict(color='lime', width=3), |
| opacity=0.3 |
| )) |
|
|
| |
| if intensity > 7: |
| fig.add_trace(go.Scatterpolar( |
| r=[intensity], theta=[angle], |
| mode='markers', |
| marker=dict(size=40, color='red', symbol='circle', opacity=0.6), |
| name="Suspicious" |
| )) |
|
|
| fig.update_layout( |
| template="plotly_dark", |
| polar=dict( |
| radialaxis=dict(visible=False, range=[0, 10]), |
| angularaxis=dict(direction="clockwise", period=360) |
| ), |
| margin=dict(l=0, r=0, t=0, b=0), |
| height=600 |
| ) |
|
|
| with placeholder.container(): |
| col1, col2 = st.columns([2, 1]) |
| with col1: |
| st.plotly_chart(fig, use_container_width=True) |
| with col2: |
| st.metric("Occupancy Status", "1 Person Detected" if intensity > 5 else "Empty") |
| st.metric("Signal Variance", f"{intensity:.2f} %") |
| if intensity > 7: |
| st.error("🚨 SUSPICIOUS ENTRY DETECTED") |
| |
| time.sleep(0.5) |