Spaces:
Running
Running
File size: 1,315 Bytes
dd8b1bf f6be049 dd8b1bf 1030c11 357994a 1237c34 938a35d 1237c34 938a35d 357994a 938a35d 357994a f6be049 357994a f6be049 357994a 82057dc 357994a 938a35d 357994a 938a35d 357994a 938a35d f89e17c 1030c11 938a35d f89e17c |
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 51 52 53 54 55 56 57 58 59 |
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
from datetime import datetime
from apscheduler.schedulers.background import BackgroundScheduler
from huggingface_hub import restart_space
import os
# Real data
#df = get_merged_dataframe()
# Dummmy data
size = 400
data = {
'date': pd.date_range(start='2023-01-01', periods=size, freq='D'),
'pm25': np.random.randint(50, 150, size=size),
'predicted_pm25': np.random.randint(50, 150, size=size)
}
df = pd.DataFrame(data)
# Page configuration
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')
# Plotting
fig = figure.plot(df)
st.plotly_chart(fig)
# Scheduling
HF_TOKEN = os.getenv("HF_TOKEN")
def restart():
restart_space("Robzy/hgb-weather", token=HF_TOKEN)
time_start = datetime.now()
scheduler = BackgroundScheduler()
job = scheduler.add_job(restart, "interval", minutes=2)
scheduler.start() |