Update app.py
Browse files
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,
|
| 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 |
|