sammy786 commited on
Commit
fabb461
·
verified ·
1 Parent(s): 0025aaa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -2610,22 +2610,21 @@ with gr.Blocks(
2610
 
2611
  ### 💡 Key Insights
2612
 
2613
- - **Biggest Single Opportunity:** ${biggest_opp:.2f} at {merchant}
2614
- - **Most Common Category:** {category}
2615
- - **Average Transaction:** ${avg_trans:.2f}
2616
- - **Optimization Potential:** {potential:.1f}% more rewards possible
2617
 
2618
  ---
2619
 
2620
  <div style="background: linear-gradient(135deg, #fff3cd 0%, #fff8e1 100%); padding: 20px; border-radius: 12px; border-left: 4px solid #ffc107; margin: 20px 0;">
2621
  <h4 style="margin: 0 0 10px 0; color: #856404;">💡 What This Means</h4>
2622
  <p style="margin: 0; color: #5d4037; font-size: 15px;">
2623
- If you had used our AI recommendations for these {count} transactions, you would have earned
2624
- <strong style="color: #e65100;">${extra:.2f} more</strong> in rewards.
2625
- Over a full year, that's <strong style="color: #e65100;">${yearly:.0f}+</strong> in extra rewards!
2626
  </p>
2627
  </div>
2628
-
2629
  ---
2630
 
2631
  <div style="background: #e8f5e9; padding: 20px; border-radius: 10px; border-left: 4px solid #4caf50;">
 
2610
 
2611
  ### 💡 Key Insights
2612
 
2613
+ - **Biggest Single Opportunity:** ${max(results, key=lambda x: x['missed_savings'])['missed_savings']:.2f} at {max(results, key=lambda x: x['missed_savings'])['merchant']}
2614
+ - **Most Common Category:** {max(set([r['category'] for r in results]), key=[r['category'] for r in results].count)}
2615
+ - **Average Transaction:** ${total_spending / len(results):.2f}
2616
+ - **Optimization Potential:** {((total_optimal_rewards - total_rewards_earned) / total_rewards_earned * 100):.1f}% more rewards possible
2617
 
2618
  ---
2619
 
2620
  <div style="background: linear-gradient(135deg, #fff3cd 0%, #fff8e1 100%); padding: 20px; border-radius: 12px; border-left: 4px solid #ffc107; margin: 20px 0;">
2621
  <h4 style="margin: 0 0 10px 0; color: #856404;">💡 What This Means</h4>
2622
  <p style="margin: 0; color: #5d4037; font-size: 15px;">
2623
+ If you had used our AI recommendations for these {len(results)} transactions, you would have earned
2624
+ <strong style="color: #e65100;">${total_missed:.2f} more</strong> in rewards.
2625
+ Over a full year, that's <strong style="color: #e65100;">${total_missed * (365 / days):.0f}+</strong> in extra rewards!
2626
  </p>
2627
  </div>
 
2628
  ---
2629
 
2630
  <div style="background: #e8f5e9; padding: 20px; border-radius: 10px; border-left: 4px solid #4caf50;">