Yuyang2022 commited on
Commit
2b376b4
1 Parent(s): d750b15
Files changed (1) hide show
  1. app.py +31 -2
app.py CHANGED
@@ -10,7 +10,10 @@ import joblib
10
  project = hopsworks.login(project="test42",api_key_value=os.environ.get("HOPSWORKS_API_KEYS"))
11
  fs = project.get_feature_store()
12
  dataset_api = project.get_dataset_api()
 
 
13
 
 
14
  def update():
15
  dataset_api.download("Resources/aqi_results.csv")
16
  aqi = pd.read_csv('aqi_results.csv')
@@ -24,6 +27,32 @@ with gr.Blocks() as demo:
24
  out = gr.Dataframe()
25
  btn = gr.Button("Refresh")
26
  btn.click(fn=update, inputs=None, outputs=out)
 
27
 
28
- if __name__ == "__main__":
29
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  project = hopsworks.login(project="test42",api_key_value=os.environ.get("HOPSWORKS_API_KEYS"))
11
  fs = project.get_feature_store()
12
  dataset_api = project.get_dataset_api()
13
+ dataset_api.download("Resources/aqi_results.csv")
14
+ aqi = pd.read_csv('aqi_results.csv')
15
 
16
+ '''
17
  def update():
18
  dataset_api.download("Resources/aqi_results.csv")
19
  aqi = pd.read_csv('aqi_results.csv')
 
27
  out = gr.Dataframe()
28
  btn = gr.Button("Refresh")
29
  btn.click(fn=update, inputs=None, outputs=out)
30
+ '''
31
 
32
+
33
+ import plotly.express as px
34
+ import pandas as pd
35
+
36
+ def plotly_plot():
37
+ # prepare some data
38
+ dataset_api.download("Resources/aqi_results.csv")
39
+ aqi = pd.read_csv('aqi_results.csv')
40
+
41
+ x = list(aqi['datetime'])
42
+ y = list(aqi['aqi'])
43
+
44
+ data = pd.DataFrame()
45
+ data['Datetime'] = x
46
+ data['AQI'] = y
47
+ # create a new plot
48
+ p = px.bar(data, x='Datetime', y='AQI')
49
+
50
+ return p
51
+
52
+ # show the results
53
+ outputs = gr.Plot()
54
+
55
+ demo1 = gr.Interface(fn=plotly_plot, inputs=None, outputs=outputs)
56
+
57
+
58
+ demo1.launch()