Spaces:
Runtime error
Runtime error
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() | |