Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -296,10 +296,9 @@ with gr.Blocks(title="AI Personal Finance Coach") as demo:
|
|
| 296 |
# Replacing 'info' with Markdown
|
| 297 |
gr.Markdown("<small>_Upload a file with 'Key: Value' pairs (e.g., 'Salary: 100000', 'Bills: 30000')._</small>")
|
| 298 |
|
| 299 |
-
# Removed 'filename' argument
|
| 300 |
download_btn = gr.DownloadButton(
|
| 301 |
label="Download Portfolio Report (.txt)",
|
| 302 |
-
value=lambda: "No data generated yet.", # Initial dummy value
|
| 303 |
scale=0
|
| 304 |
)
|
| 305 |
|
|
@@ -445,11 +444,12 @@ with gr.Blocks(title="AI Personal Finance Coach") as demo:
|
|
| 445 |
queue=False,
|
| 446 |
).then(
|
| 447 |
# Second chain: Update the state and download button content after analysis
|
|
|
|
| 448 |
fn=lambda *args: (args[-1], generate_portfolio_download(*args[1:10], args[-1])),
|
| 449 |
inputs=[
|
| 450 |
api_key_input, salary_input, sip_input, bills_input, shopping_input, dining_input,
|
| 451 |
entertainment_input, travel_input, other_expenses_input, target_surplus_input,
|
| 452 |
-
ai_response_output
|
| 453 |
],
|
| 454 |
outputs=[last_ai_response, download_btn],
|
| 455 |
queue=False,
|
|
|
|
| 296 |
# Replacing 'info' with Markdown
|
| 297 |
gr.Markdown("<small>_Upload a file with 'Key: Value' pairs (e.g., 'Salary: 100000', 'Bills: 30000')._</small>")
|
| 298 |
|
| 299 |
+
# Removed 'filename' argument and initial 'value' lambda for compatibility
|
| 300 |
download_btn = gr.DownloadButton(
|
| 301 |
label="Download Portfolio Report (.txt)",
|
|
|
|
| 302 |
scale=0
|
| 303 |
)
|
| 304 |
|
|
|
|
| 444 |
queue=False,
|
| 445 |
).then(
|
| 446 |
# Second chain: Update the state and download button content after analysis
|
| 447 |
+
# The lambda retrieves the AI response from the last position (args[-1]) and the 9 numeric inputs (args[1:10])
|
| 448 |
fn=lambda *args: (args[-1], generate_portfolio_download(*args[1:10], args[-1])),
|
| 449 |
inputs=[
|
| 450 |
api_key_input, salary_input, sip_input, bills_input, shopping_input, dining_input,
|
| 451 |
entertainment_input, travel_input, other_expenses_input, target_surplus_input,
|
| 452 |
+
ai_response_output # This component's value is passed as the last argument
|
| 453 |
],
|
| 454 |
outputs=[last_ai_response, download_btn],
|
| 455 |
queue=False,
|