File size: 1,319 Bytes
dd8b1bf
 
 
 
 
f6be049
dd8b1bf
1030c11
357994a
1237c34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357994a
 
 
f6be049
357994a
 
 
 
f6be049
357994a
 
 
82057dc
 
 
357994a
f6be049
 
357994a
 
 
 
f6be049
1030c11
357994a
f6be049
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
50
import streamlit as st
import pandas as pd
import numpy as np
import datetime
import hopsworks
from functions import figure, util
import os
import pickle
import plotly.express as px
import json

# Set up
api_key = os.getenv('HOPSWORKS_API_KEY')
project_name = os.getenv('HOPSWORKS_PROJECT')
project = hopsworks.login(project=project_name, api_key_value=api_key)
fs = project.get_feature_store() 
secrets = util.secrets_api(project.name)

feature_view = fs.get_feature_view(
    name='air_quality_fv',
    version=1,
)
df = feature_view.get_batch_data(start_time=None, end_time=None, read_options=None).sort_values(by='date')
today = datetime.datetime.now() - datetime.timedelta(0)


st.set_page_config(
    page_title="Air Quality Prediction",
    page_icon="🧊",
    layout="wide",
    initial_sidebar_state="expanded",
    menu_items={
        'About': "# Air Quality Prediction"
    }
)

st.title('Lahore Air Quality')
st.subheader('Forecast and hindcast')
st.subheader('Unit: PM25 - particle matter of diameter < 2.5 micrometers')

#pickle_file_path = 'air_quality_df.pkl'
pickle_file_path = 'outcome_df.pkl'

with open(pickle_file_path, 'rb') as file:
    st.session_state.df = pickle.load(file).sort_values(by="date")

fig = figure.plot(st.session_state.df)

# Render the chart in Streamlit
st.plotly_chart(fig)