YAMITEK commited on
Commit
f0bf78e
·
verified ·
1 Parent(s): eff35dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -58
app.py CHANGED
@@ -1,58 +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")
 
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, use_container_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")