Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,7 +137,7 @@ def update_table(start_date, end_date, window, user_text):
|
|
| 137 |
global df # Use global variable
|
| 138 |
#global df_2
|
| 139 |
df = df_predictions.copy()
|
| 140 |
-
max_row_index = df['
|
| 141 |
df = df.style.apply(lambda x: ['background-color: #d9f7be; color: black' if x.name == max_row_index else '' for i in x], axis=1)
|
| 142 |
#df_2 = df_payments.copy()
|
| 143 |
return df#, df_2
|
|
@@ -182,9 +182,9 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 182 |
range_input = gr.Slider(3, 12, 6, step=1, label="Window / Moving Average Period")
|
| 183 |
gr.Markdown("Window = 3-period/months, the predictive model reacts more quickly to recent monthly payment fluctuations, but it may also include more noise.<br><br>Window = 12-period/months, the Forecast adjusts more slowly and is less sensitive to small fluctuations, making it more reliable, but also slower to react to sharp changes.")
|
| 184 |
btn_update = gr.Button("Run Forecast")
|
| 185 |
-
gr.HTML(f"<
|
| 186 |
-
gr.Markdown("It's recommended to make the
|
| 187 |
-
table_1 = gr.DataFrame(value=df, label="Predictions - consult 'Prediction Revenue' column:")
|
| 188 |
#table_2 = gr.DataFrame(value=df_2, label="Forecast Inputs:")
|
| 189 |
btn_update.click(fn=update_table, inputs=[start_input, prediction_input, range_input, user_text], outputs=[table_1#,table_2
|
| 190 |
])
|
|
|
|
| 137 |
global df # Use global variable
|
| 138 |
#global df_2
|
| 139 |
df = df_predictions.copy()
|
| 140 |
+
max_row_index = df['Predicted Revenue'].idxmax()
|
| 141 |
df = df.style.apply(lambda x: ['background-color: #d9f7be; color: black' if x.name == max_row_index else '' for i in x], axis=1)
|
| 142 |
#df_2 = df_payments.copy()
|
| 143 |
return df#, df_2
|
|
|
|
| 182 |
range_input = gr.Slider(3, 12, 6, step=1, label="Window / Moving Average Period")
|
| 183 |
gr.Markdown("Window = 3-period/months, the predictive model reacts more quickly to recent monthly payment fluctuations, but it may also include more noise.<br><br>Window = 12-period/months, the Forecast adjusts more slowly and is less sensitive to small fluctuations, making it more reliable, but also slower to react to sharp changes.")
|
| 184 |
btn_update = gr.Button("Run Forecast")
|
| 185 |
+
gr.HTML(f"<h2>Predictions</h2>")
|
| 186 |
+
gr.Markdown("It's recommended to make the predictions after the selected month has passed.")
|
| 187 |
+
table_1 = gr.DataFrame(value=df, label="Predictions -> consult 'Prediction Revenue' column:")
|
| 188 |
#table_2 = gr.DataFrame(value=df_2, label="Forecast Inputs:")
|
| 189 |
btn_update.click(fn=update_table, inputs=[start_input, prediction_input, range_input, user_text], outputs=[table_1#,table_2
|
| 190 |
])
|