Spaces:
Runtime error
Runtime error
File size: 1,335 Bytes
bc7d5f7 d750b15 bc7d5f7 2ef732c bc7d5f7 2b376b4 bc7d5f7 2b376b4 bc7d5f7 2b376b4 bc7d5f7 2b376b4 |
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 gradio as gr
import numpy as np
from PIL import Image
import requests
import os
import hopsworks
import joblib
project = hopsworks.login(project="test42",api_key_value=os.environ.get("HOPSWORKS_API_KEYS"))
fs = project.get_feature_store()
dataset_api = project.get_dataset_api()
dataset_api.download("Resources/aqi_results.csv")
aqi = pd.read_csv('aqi_results.csv')
'''
def update():
dataset_api.download("Resources/aqi_results.csv")
aqi = pd.read_csv('aqi_results.csv')
return aqi
with gr.Blocks() as demo:
gr.Markdown("Air Quality Index Prediction")
with gr.Row():
with gr.Column():
gr.Label("Predicted AQI in next 7 days in Singapore")
out = gr.Dataframe()
btn = gr.Button("Refresh")
btn.click(fn=update, inputs=None, outputs=out)
'''
import plotly.express as px
import pandas as pd
def plotly_plot():
# prepare some data
dataset_api.download("Resources/aqi_results.csv")
aqi = pd.read_csv('aqi_results.csv')
x = list(aqi['datetime'])
y = list(aqi['aqi'])
data = pd.DataFrame()
data['Datetime'] = x
data['AQI'] = y
# create a new plot
p = px.bar(data, x='Datetime', y='AQI')
return p
# show the results
outputs = gr.Plot()
demo1 = gr.Interface(fn=plotly_plot, inputs=None, outputs=outputs)
demo1.launch()
|