Spaces:
Runtime error
Runtime error
bug fix
Browse files
app.py
CHANGED
|
@@ -145,9 +145,33 @@ def main():
|
|
| 145 |
|
| 146 |
if st.button("Forecast Sales", type="primary"):
|
| 147 |
dataloader = prepare_dataset(parameters, df.copy(), st.session_state.rain, st.session_state.temperature, st.session_state.date, rain_mapping)
|
| 148 |
-
preds = predict(model, dataloader,
|
| 149 |
update_plot(df, preds, axs, fig)
|
| 150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
if __name__ == '__main__':
|
| 152 |
main()
|
| 153 |
|
|
|
|
| 145 |
|
| 146 |
if st.button("Forecast Sales", type="primary"):
|
| 147 |
dataloader = prepare_dataset(parameters, df.copy(), st.session_state.rain, st.session_state.temperature, st.session_state.date, rain_mapping)
|
| 148 |
+
preds = predict(model, dataloader, st.session_state.date)
|
| 149 |
update_plot(df, preds, axs, fig)
|
| 150 |
|
| 151 |
+
def update_plot2(ax):
|
| 152 |
+
x = np.linspace(0, 2*np.pi, 100)
|
| 153 |
+
y = np.sin(x)
|
| 154 |
+
ax.plot(x, y, label='New Line')
|
| 155 |
+
ax.legend()
|
| 156 |
+
st.pyplot()
|
| 157 |
+
|
| 158 |
+
# Create an initial plot
|
| 159 |
+
figs, ax = plt.subplots()
|
| 160 |
+
x_initial = np.linspace(0, 2*np.pi, 100)
|
| 161 |
+
y_initial = np.cos(x_initial)
|
| 162 |
+
ax.plot(x_initial, y_initial, label='Initial Line')
|
| 163 |
+
ax.set_xlabel('X-axis')
|
| 164 |
+
ax.set_ylabel('Y-axis')
|
| 165 |
+
ax.set_title('Plot')
|
| 166 |
+
ax.legend()
|
| 167 |
+
st.pyplot(figs)
|
| 168 |
+
|
| 169 |
+
# Button to update the plot
|
| 170 |
+
if st.button('Add Line'):
|
| 171 |
+
update_plot2(ax)
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
|
| 175 |
if __name__ == '__main__':
|
| 176 |
main()
|
| 177 |
|