File size: 1,082 Bytes
54fabf6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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)**")