ProjectSEAS's picture
Update app.py
496eb5b verified
Raw History Blame Contribute Delete
1.44 kB
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"]])