Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ import numpy as np
|
|
| 11 |
def load_sample_data():
|
| 12 |
data = {
|
| 13 |
"Date": pd.date_range(start="2023-01-01", periods=100, freq="D"),
|
| 14 |
-
"Location": np.random.choice(["
|
| 15 |
"AQI": np.random.randint(50, 200, size=100), # Random AQI values
|
| 16 |
"Temperature": np.random.uniform(20, 35, size=100),
|
| 17 |
"Humidity": np.random.uniform(30, 80, size=100),
|
|
@@ -68,19 +68,4 @@ st.markdown(
|
|
| 68 |
# Sidebar inputs
|
| 69 |
st.sidebar.header("Input Parameters")
|
| 70 |
location = st.sidebar.selectbox("Select Location", data["Location"].unique())
|
| 71 |
-
temperature = st.sidebar.slider("Temperature (°C)", 20, 40,
|
| 72 |
-
humidity = st.sidebar.slider("Humidity (%)", 30, 90, 50)
|
| 73 |
-
|
| 74 |
-
# Prediction
|
| 75 |
-
st.subheader("Predicted AQI")
|
| 76 |
-
prediction = predict_aqi(model, temperature, humidity)
|
| 77 |
-
st.write(f"The predicted AQI for {location} is: {prediction}")
|
| 78 |
-
|
| 79 |
-
# Historical trends visualization
|
| 80 |
-
st.subheader("Historical Data Trends")
|
| 81 |
-
trends_image = plot_trends(data, location)
|
| 82 |
-
st.image(trends_image)
|
| 83 |
-
|
| 84 |
-
# Model performance
|
| 85 |
-
st.sidebar.subheader("Model Performance")
|
| 86 |
-
st.sidebar.write(f"Mean Squared Error: {mse:.2f}")
|
|
|
|
| 11 |
def load_sample_data():
|
| 12 |
data = {
|
| 13 |
"Date": pd.date_range(start="2023-01-01", periods=100, freq="D"),
|
| 14 |
+
"Location": np.random.choice(["Karachi", "Lahore", "Islamabad", "Peshawar", "Quetta"], size=100),
|
| 15 |
"AQI": np.random.randint(50, 200, size=100), # Random AQI values
|
| 16 |
"Temperature": np.random.uniform(20, 35, size=100),
|
| 17 |
"Humidity": np.random.uniform(30, 80, size=100),
|
|
|
|
| 68 |
# Sidebar inputs
|
| 69 |
st.sidebar.header("Input Parameters")
|
| 70 |
location = st.sidebar.selectbox("Select Location", data["Location"].unique())
|
| 71 |
+
temperature = st.sidebar.slider("Temperature (°C)", 20, 40,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|