File size: 826 Bytes
8e5eb32
43106f9
 
 
f2e3576
 
b6936bb
8e5eb32
43106f9
 
8e5eb32
f2e3576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8e5eb32
43106f9
f2e3576
b6936bb
 
 
43106f9
fdfd633
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
import gradio as gr
import pandas as pd
import numpy as np
import random
import os 
import hopsworks
from gradio_datetimerange import DateTimeRange

from datetime import datetime, timedelta
now = datetime.now()

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() 

air_quality_fg = fs.get_feature_group(
    name='air_quality',
    version=1,
)
air_quality_df = air_quality_fg.read()
air_quality_df

print(air_quality_df.info())
print(air_quality_df)

with gr.Blocks() as demo:
    gr.Markdown("Helsingborg Air Quality Forecast")
    daterange = DateTimeRange(["now - 24h", "now"])
    plot = gr.LinePlot(air_quality_df, x="date", y="pm25")
    daterange.bind([plot])

demo.launch()