Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import random
|
4 |
+
|
5 |
+
# Function to simulate gas sensor data
|
6 |
+
def generate_sensor_data():
|
7 |
+
gases = ["CO2", "O2", "N2", "CFC", "CO", "SO", "NO"]
|
8 |
+
data = {gas: round(random.uniform(0, 100), 2) for gas in gases}
|
9 |
+
return data
|
10 |
+
|
11 |
+
# Title and description
|
12 |
+
st.title("Gas Mixture Sensor Dashboard")
|
13 |
+
st.markdown("""
|
14 |
+
This app simulates gas sensor readings from the surrounding air.
|
15 |
+
It displays the concentrations of various gases (in arbitrary units) that change dynamically based on location or time.
|
16 |
+
""")
|
17 |
+
|
18 |
+
# Sidebar for location selection
|
19 |
+
st.sidebar.header("Settings")
|
20 |
+
location = st.sidebar.selectbox(
|
21 |
+
"Select a Location",
|
22 |
+
["Urban Area", "Industrial Zone", "Forest", "Mountain", "Coastal Region"]
|
23 |
+
)
|
24 |
+
|
25 |
+
st.sidebar.write("Selected Location:", location)
|
26 |
+
|
27 |
+
# Display sensor data
|
28 |
+
st.subheader("Live Sensor Data")
|
29 |
+
sensor_data = generate_sensor_data()
|
30 |
+
sensor_df = pd.DataFrame(list(sensor_data.items()), columns=["Gas", "Concentration"])
|
31 |
+
st.table(sensor_df)
|
32 |
+
|
33 |
+
# Visualize data
|
34 |
+
st.subheader("Gas Concentration Visualization")
|
35 |
+
st.bar_chart(sensor_df.set_index("Gas"))
|
36 |
+
|
37 |
+
# Additional info
|
38 |
+
st.markdown("""
|
39 |
+
*Note: The data displayed here is simulated and for demonstration purposes only.*
|
40 |
+
""")
|