Spaces:
Build error
Build error
File size: 1,442 Bytes
1cb3426 496eb5b 1cb3426 | 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import subprocess
subprocess.run(["pip", "install", "matplotlib"])
import matplotlib.pyplot as plt
# Title
st.title("📊 Project SEAS - Environmental Data Analysis")
st.write("""
Upload your sensor data to analyze trends and relationships between environmental parameters.
""")
# Upload CSV file
uploaded_file = st.file_uploader("Upload your sensor data (CSV)", type=["csv"])
if uploaded_file is not None:
# Read the CSV file
df = pd.read_csv(uploaded_file)
# Show raw data
st.write("### Raw Data Preview")
st.dataframe(df)
# Show statistics
st.write("### Summary Statistics")
st.write(df.describe())
# Correlation Heatmap
st.write("### Correlation Heatmap")
fig, ax = plt.subplots(figsize=(10, 6))
sns.heatmap(df.corr(), annot=True, cmap="coolwarm", ax=ax)
st.pyplot(fig)
# Plot Temperature vs. pH Levels
st.write("### Relationship Between Water Temperature and pH Levels")
fig, ax = plt.subplots()
sns.scatterplot(data=df, x="Water Temperature", y="pH Level", ax=ax)
st.pyplot(fig)
# Custom Analysis: Predicting pH Changes Based on Temperature
st.write("### AI-Based pH Level Prediction")
df["Predicted pH"] = df["pH Level"] + (0.01 * (df["Water Temperature"] - df["Water Temperature"].mean()))
st.line_chart(df[["pH Level", "Predicted pH"]])
|