|
import streamlit as st |
|
import pandas as pd |
|
import random |
|
|
|
|
|
def generate_sensor_data(): |
|
gases = ["CO2", "O2", "N2", "CFC", "CO", "SO", "NO"] |
|
data = {gas: round(random.uniform(0, 100), 2) for gas in gases} |
|
return data |
|
|
|
|
|
st.title("Gas Mixture Sensor Dashboard") |
|
st.markdown(""" |
|
This app simulates gas sensor readings from the surrounding air. |
|
It displays the concentrations of various gases (in arbitrary units) that change dynamically based on location or time. |
|
""") |
|
|
|
|
|
st.sidebar.header("Settings") |
|
location = st.sidebar.selectbox( |
|
"Select a Location", |
|
["Urban Area", "Industrial Zone", "Forest", "Mountain", "Coastal Region"] |
|
) |
|
|
|
st.sidebar.write("Selected Location:", location) |
|
|
|
|
|
st.subheader("Live Sensor Data") |
|
sensor_data = generate_sensor_data() |
|
sensor_df = pd.DataFrame(list(sensor_data.items()), columns=["Gas", "Concentration"]) |
|
st.table(sensor_df) |
|
|
|
|
|
st.subheader("Gas Concentration Visualization") |
|
st.bar_chart(sensor_df.set_index("Gas")) |
|
|
|
|
|
st.markdown(""" |
|
*Note: The data displayed here is simulated and for demonstration purposes only.* |
|
""") |
|
|