IsacLorentz commited on
Commit
343f2f3
1 Parent(s): d4e6ae3
Files changed (2) hide show
  1. app.py +8 -2
  2. requirements.txt +1 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import numpy as np
3
  import datetime
4
  import pandas as pd
 
5
 
6
  import hopsworks
7
 
@@ -24,8 +25,12 @@ def get_price():
24
  price_predictions = pd.DataFrame()
25
  price_predictions['date'] = dates
26
  price_predictions['price'] = prices
 
 
 
 
27
  # print(price_predictions)
28
- return price_predictions
29
 
30
  demo = gr.Interface(
31
  fn=get_price,
@@ -33,7 +38,8 @@ demo = gr.Interface(
33
  description="Predicted daily average energy prices over the coming 7 days",
34
  allow_flagging="never",
35
  inputs=[],
36
- outputs=gr.Timeseries(x="date", y=["price"]))
 
37
 
38
  demo.launch()
39
 
 
2
  import numpy as np
3
  import datetime
4
  import pandas as pd
5
+ import matplotlib.pyplot as plt
6
 
7
  import hopsworks
8
 
 
25
  price_predictions = pd.DataFrame()
26
  price_predictions['date'] = dates
27
  price_predictions['price'] = prices
28
+
29
+ fig = plt.figure()
30
+ price_predictions.plot(kind='line', x='date', y='price')
31
+
32
  # print(price_predictions)
33
+ return fig
34
 
35
  demo = gr.Interface(
36
  fn=get_price,
 
38
  description="Predicted daily average energy prices over the coming 7 days",
39
  allow_flagging="never",
40
  inputs=[],
41
+ outputs=['plot']
42
+ )
43
 
44
  demo.launch()
45
 
requirements.txt CHANGED
@@ -1 +1,2 @@
1
  hopsworks
 
 
1
  hopsworks
2
+ pyplot