Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -165,13 +165,17 @@ with gr.Blocks(title="Retail Finance: Spend Forecast") as demo:
|
|
| 165 |
"Upload your transactions CSV (columns: `date, amount, category, income`) or use demo data. "
|
| 166 |
"The model forecasts **next-month spend** and flags **overspend risk**."
|
| 167 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
with gr.Row():
|
| 169 |
file = gr.File(label="Upload CSV (optional)")
|
| 170 |
budget = gr.Number(value=2500, label="Monthly budget (positive number)")
|
| 171 |
btn = gr.Button("Run Forecast")
|
| 172 |
summary = gr.Dataframe(label="Summary")
|
| 173 |
monthly_table = gr.Dataframe(label="Monthly aggregates used by the model")
|
| 174 |
-
|
| 175 |
|
| 176 |
if __name__ == "__main__":
|
| 177 |
demo.launch()
|
|
|
|
| 165 |
"Upload your transactions CSV (columns: `date, amount, category, income`) or use demo data. "
|
| 166 |
"The model forecasts **next-month spend** and flags **overspend risk**."
|
| 167 |
)
|
| 168 |
+
with gr.Row():
|
| 169 |
+
file = gr.File(label="Upload CSV (optional)")
|
| 170 |
+
budget = gr.Number(value=2500, label="Monthly budget (positive number)")
|
| 171 |
+
income_override = gr.Number(value=None, label="Expected income next month (optional)")
|
| 172 |
with gr.Row():
|
| 173 |
file = gr.File(label="Upload CSV (optional)")
|
| 174 |
budget = gr.Number(value=2500, label="Monthly budget (positive number)")
|
| 175 |
btn = gr.Button("Run Forecast")
|
| 176 |
summary = gr.Dataframe(label="Summary")
|
| 177 |
monthly_table = gr.Dataframe(label="Monthly aggregates used by the model")
|
| 178 |
+
btn.click(safe_run, inputs=[file, budget, income_override], outputs=[summary, monthly_table])
|
| 179 |
|
| 180 |
if __name__ == "__main__":
|
| 181 |
demo.launch()
|