Spaces:
Build error
Build error
Upload 3 files
Browse files- Air_pollution_prediction_rf_model.joblib +3 -0
- app.py +58 -0
- requirement.txt +10 -0
Air_pollution_prediction_rf_model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f7cd981ff9837a61c6f4a5cd61496bb248ad9d7f8ce595b606301a716bfc2f7b
|
| 3 |
+
size 3162977
|
app.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import joblib
|
| 3 |
+
from datetime import date
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
html_temp = """
|
| 8 |
+
<div style="background-color:tomato;padding:10px">
|
| 9 |
+
<h2 style="color:white;text-align:center;">Streamlit AIR Pollution Prediciton ML App </h2>
|
| 10 |
+
</div>
|
| 11 |
+
"""
|
| 12 |
+
st.markdown(html_temp, unsafe_allow_html=True)
|
| 13 |
+
|
| 14 |
+
image_url="https://wallpapercave.com/wp/wp6100544.jpg"
|
| 15 |
+
|
| 16 |
+
st.image(image_url, caption="Image from URL", use_column_width=True)
|
| 17 |
+
|
| 18 |
+
# Name
|
| 19 |
+
name=st.selectbox("Select Name" ,options=['Emissions',"Pollution","Asthma-Related","Hospitalizations"])
|
| 20 |
+
name_index=['Emissions',"Pollution","Asthma-Related","Hospitalizations"]
|
| 21 |
+
name_value= name_index.index(name)
|
| 22 |
+
|
| 23 |
+
# Measure
|
| 24 |
+
measure=st.selectbox("Select Measure ",options=["Density","Miles","Rates","Concentration"])
|
| 25 |
+
measure_index=["Density","Miles","Rates","Concentration"]
|
| 26 |
+
measure_value =measure_index.index(measure)
|
| 27 |
+
|
| 28 |
+
# Geo_Type_Name
|
| 29 |
+
Geo_Type_Name=st.selectbox('Select Geo_Type_Name',options=["UHF42",'UHF34','Borough','CD','Citywi'])
|
| 30 |
+
Geo_Type_Name_index=["UHF42",'UHF34','Borough','CD','Citywi']
|
| 31 |
+
Geo_Type_Name_value =Geo_Type_Name_index.index(Geo_Type_Name)
|
| 32 |
+
|
| 33 |
+
# Geo_Place_Name
|
| 34 |
+
Geo_Place_Name=st.selectbox('Select Geo_Place_Name',options=['Queens','Unknown','Brooklyn','Bronx','Manhattan','Staten Island=5'])
|
| 35 |
+
Geo_Place_Name_index=['Queens','Unknown','Brooklyn','Bronx','Manhattan','Staten Island=5']
|
| 36 |
+
Geo_Place_Name_value=Geo_Place_Name_index.index(Geo_Place_Name)
|
| 37 |
+
|
| 38 |
+
#time_period
|
| 39 |
+
time_period=st.selectbox('select Time Period',options=['Other','Annual Average','Summer','Winter'])
|
| 40 |
+
time_period_index=['Other','Annual Average','Summer','Winter']
|
| 41 |
+
time_period_value=time_period_index.index(time_period)
|
| 42 |
+
|
| 43 |
+
# Data_Values
|
| 44 |
+
Data_values=st.slider("Enter The Data Values",min_value=0,max_value=424,value=1)
|
| 45 |
+
|
| 46 |
+
# model
|
| 47 |
+
model=joblib.load('Air_pollution_prediction_rf_model.joblib')
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
if st.button("submit"):
|
| 51 |
+
output=model.predict([[name_value,measure_value,Geo_Type_Name_value,Geo_Place_Name_value,time_period_value,Data_values]])
|
| 52 |
+
|
| 53 |
+
if output==0:
|
| 54 |
+
st.text_area('',' Air Pollution is Moderate')
|
| 55 |
+
elif output==1:
|
| 56 |
+
st.text_area('',' Air Pollution is Good')
|
| 57 |
+
elif output==2:
|
| 58 |
+
st.text_area('',"Air Pollution is Bad")
|
requirement.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
joblib==1.3.2
|
| 2 |
+
matplotlib==3.8.3
|
| 3 |
+
matplotlib-inline==0.1.6
|
| 4 |
+
numpy==1.26.4
|
| 5 |
+
pandas==2.2.0
|
| 6 |
+
scikit-learn==1.4.1.post1
|
| 7 |
+
seaborn==0.13.2
|
| 8 |
+
stack-data==0.6.3
|
| 9 |
+
streamlit==1.32.2
|
| 10 |
+
streamlit-chat==0.1.1
|