Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import random | |
| st.title("πΆ WiFi Signal Analyzer") | |
| st.write("π£ Walk around your room and press the button below at each spot to record signal strength (simulated).") | |
| # Simulated data store | |
| if "data" not in st.session_state: | |
| st.session_state.data = [] | |
| # Simulate WiFi strength capture | |
| if st.button("π Record Signal Strength at Current Position"): | |
| strength = random.randint(-90, -30) # Simulated dBm | |
| position = len(st.session_state.data) + 1 | |
| st.session_state.data.append({"Position": position, "Signal Strength (dBm)": strength}) | |
| st.success(f"Recorded signal: {strength} dBm at position {position}") | |
| # Display data | |
| if st.session_state.data: | |
| df = pd.DataFrame(st.session_state.data) | |
| st.line_chart(df.set_index("Position")) | |
| # Suggest best location | |
| best_row = df[df["Signal Strength (dBm)"] == df["Signal Strength (dBm)"].max()] | |
| st.markdown(f"β **Best Signal at Position {best_row.iloc[0]['Position']} ({best_row.iloc[0]['Signal Strength (dBm)']} dBm)**") | |