farquasar commited on
Commit
d47afb2
·
verified ·
1 Parent(s): 6462d42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -171,9 +171,9 @@ def plot(y, label, timeframe='1h', ma=5, n_steps=None):
171
  plt.figure(figsize=(12,6))
172
  if ma:
173
  df_plot = pd.DataFrame({'date': label['timestamp'].values[-n_steps:], 'prediction':5*(y[-n_steps:]-0.5), 'real': label['close'].values[-n_steps:]})
174
- plt.plot(df_plot['date'], df_plot['prediction'].rolling(window=ma).mean(), label='updown')
175
- plt.plot(df_plot['date'], df_plot['real'].rolling(window=ma).mean(), label='real')
176
- plt.plot(df_plot['date'], (df_plot['real']-df_plot['prediction']).rolling(window=ma).mean(), label='difference')
177
  else:
178
  plt.plot(label['timestamp'].values[-n_steps:], 5*(y[-n_steps:]-0.5), label='updown')
179
  plt.plot(label['timestamp'].values[-n_steps:], label['close'].values[-n_steps:], label='real')
@@ -235,7 +235,7 @@ with gr.Blocks() as demo:
235
  # wire it up
236
  run_btn.click(
237
  fn=predict_both_plots,
238
- inputs=[limit, epsilon, n_steps, ma],
239
  outputs=[plot1, plot2]
240
  )
241
 
 
171
  plt.figure(figsize=(12,6))
172
  if ma:
173
  df_plot = pd.DataFrame({'date': label['timestamp'].values[-n_steps:], 'prediction':5*(y[-n_steps:]-0.5), 'real': label['close'].values[-n_steps:]})
174
+ plt.plot(df_plot['date'], df_plot['prediction'].rolling(window=ma).mean(), marker='o', line_width=3, label='updown')
175
+ plt.plot(df_plot['date'], df_plot['real'].rolling(window=ma).mean(), marker='o', line_width=3, label='real')
176
+ plt.plot(df_plot['date'], (df_plot['real']-df_plot['prediction']).rolling(window=ma).mean(), marker='o', line_width=3, label='difference')
177
  else:
178
  plt.plot(label['timestamp'].values[-n_steps:], 5*(y[-n_steps:]-0.5), label='updown')
179
  plt.plot(label['timestamp'].values[-n_steps:], label['close'].values[-n_steps:], label='real')
 
235
  # wire it up
236
  run_btn.click(
237
  fn=predict_both_plots,
238
+ inputs=[limit, epsilon, ma],
239
  outputs=[plot1, plot2]
240
  )
241