jeronimo9 commited on
Commit
febb144
Β·
verified Β·
1 Parent(s): 781d332

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +141 -111
app.py CHANGED
@@ -349,67 +349,92 @@ def recommend_preamble_solution(industry,
349
  if has_ai_app:
350
  solution = "Guardrails Only"
351
  monthly_cost = api_calls * 0.005
352
- description = f"""### ⚑ Guardrails Only
353
- Perfect for integrating with your existing AI application:
354
- - Quick API integration.
355
- - Pre-built security and privacy guardrails.
356
- - Basic compliance templates.
357
- - Agentless operation.
358
- - Free Trial available.
359
- - Free Shadow AI Tool {shadow_ai_blocker}
360
- $0.005 per API call (Est. monthly cost: ${monthly_cost:,.2f} at {api_calls:,} calls/month)"""
 
 
 
 
 
361
  image = "πŸ›‘οΈ"
362
  else:
363
  solution = "SMB"
364
- description = f"""### πŸš€ SMB
365
- Perfect for teams getting started with AI:
366
- - Full platform features.
367
- - Standard compliance templates.
368
- - Protection for up to 25 AI applications.
369
- - Secure Knowledge Base.
370
- - SaaS Hosting.
371
- - Free Shadow AI Tool {shadow_ai_blocker}
372
- $50 per user/month"""
 
 
 
 
 
373
  image = "🏒"
374
  elif org_size >= 1000 or industry in high_risk_industries:
375
  solution = "Enterprise"
376
- description = f"""### 🏒 Enterprise License
377
- Perfect for large or high-risk organizations:
378
- - Complete compliance controls.
379
- - Custom AI Assistant Development Support.
380
- - Dedicated support team.
381
- - Private AI Marketplace.
382
- - Custom integrations.
383
- - Private cloud/on-premise options.
384
- - Free Shadow AI Tool {shadow_ai_blocker}
385
- Starting at $27,000/month with discounts for multi-year deals"""
 
 
 
 
 
386
  image = "πŸš€"
387
  elif org_size >= 100:
388
  solution = "SMB"
389
- description = f"""### πŸš€ SMB
390
- Perfect for teams getting started with AI:
391
- - Full platform features.
392
- - Standard compliance templates.
393
- - Custom AI Assistants.
394
- - Safe AI Search Agent
395
- - Secure Knowledge Base.
396
- - SaaS Hosting.
397
- - Free Shadow AI Tool {shadow_ai_blocker}
398
- $50 per user/month"""
 
 
 
 
 
399
  image = "🏒"
400
 
401
  else:
402
  solution = "Guardrails Only"
403
  monthly_cost = api_calls * 0.005
404
- description = f"""### ⚑ Guardrails Only
405
- Perfect for integrating with your existing AI application:
406
- - Quick API integration.
407
- - Pre-built security and privacy guardrails.
408
- - Basic compliance templates.
409
- - Agentless operation.
410
- - Free Trial available.
411
- - Free Shadow AI Tool {shadow_ai_blocker}
412
- $0.005 per API call (Est. monthly cost: ${monthly_cost:,.2f} at {api_calls:,} calls/month)"""
 
 
 
 
 
413
  image = "πŸ›‘οΈ"
414
  return {"solution": solution, "description": description, "image": image}
415
 
@@ -545,64 +570,69 @@ def generate_recommendations(industry,
545
  security_compliance
546
  )
547
 
548
- dept_recommendations = "".join(
549
- f"\n {i+1}. **{dept['Department']}** (ROI: {dept['ROI']:.1f}%)"
550
- f"\n - Annual cost savings: ${dept['Annual Cost Savings']:,.2f}"
551
- f"\n - Hours saved annually: {dept['Annual Hours Saved']:,.0f}"
552
- f"\n - Top AI use cases:\n - " +
553
- "\n - ".join(dept["Use Cases"]) + "\n"
554
- for i, dept in enumerate(top_departments))
555
-
556
- security_text = "\n\n### Key Security Considerations\n" + "\n".join(
557
- f"- {risk}" for risk in industry_risks)
558
-
559
- subscription_text = (
560
- f"\n### Subscription & Tool Optimization\n- **Current annual spend:** ${subscription_savings['total_current_cost']:,.2f}\n"
561
- f"- **Potential annual savings:** ${subscription_savings['total_savings']:,.2f} ({subscription_savings['savings_percentage']:.1f}%)\n"
562
- f"- **Recommendation:** Evaluate consolidation of overlapping tools with AI capabilities\n"
563
- )
564
-
565
- compliance_text = (
566
- f"\n### Compliance Risk Reduction\n- **Potential risk exposure reduction:** ${compliance_savings['total_savings']:,.2f}\n"
567
- f"- **Key regulations to address:**\n" +
568
- "".join(f" - {reg['name']}: ${reg['cost']:,.2f} risk exposure\n"
569
- for reg in compliance_savings['key_regulations']))
570
-
571
-
572
- build_vs_buy_text = (
573
- f"\n### Build vs Buy Analysis\n"
574
- f"- **Building in-house:**\n"
575
- f" - First year cost: ${comparison['first_year_build']:,.2f}\n"
576
- f" - Ongoing annual cost: ${comparison['ongoing_annual_build']:,.2f}\n"
577
- f" - 3-year total cost: ${comparison['three_year_build']:,.2f}\n\n"
578
- f"- **Preamble Enterprise:**\n"
579
- f" - Annual cost: ${comparison['annual_preamble']:,.2f}\n"
580
- f" - 3-year total cost: ${comparison['three_year_preamble']:,.2f}\n\n"
581
- f"- **3-year savings with Preamble:** ${comparison['three_year_savings']:,.2f} ({comparison['savings_percentage']:.1f}%)\n"
582
- f"- **ROI:** {((comparison['three_year_savings'] / comparison['three_year_preamble']) * 100):,.1f}%\n"
583
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
 
585
  report = (
586
- f"# AI Implementation & Security Recommendation\n## Executive Summary\n"
587
- f"**Industry:** {industry}\n**Organization Size:** {org_size:,} employees\n"
588
- f"**Monthly Budget:** ${monthly_budget:,.2f}\n"
589
- f"**Existing AI Application:** {'Yes' if has_ai_app else 'No'}\n"
590
- f"**Total Potential Annual Savings:** ${total_dept_savings + subscription_savings['total_savings'] + compliance_savings['total_savings']:,.2f}\n\n"
591
  f"## Recommended Preamble Solution\n{solution_rec['image']} {solution_rec['description']}\n\n"
592
  f"{build_vs_buy_text}\n"
593
- f"## Department Recommendations\nThe following departments show the highest potential ROI for AI implementation:\n{dept_recommendations}\n"
594
- f"{subscription_text}{compliance_text}{security_text}\n\n## Implementation Roadmap\n\n"
595
- f"1. **Phase 1: Security Foundation** (1-2 months)\n"
596
- f" - Deploy Preamble {solution_rec['solution']}\n"
597
- f" - Establish AI governance framework\n"
598
- f" - Train key personnel\n\n"
599
- f"2. **Phase 2: Department Pilots** (2-3 months)\n"
600
- f" - Implement AI use cases in {top_departments[0]['Department']}\n"
601
- f" - Measure results\n\n"
602
- f"3. **Phase 3: Expansion** (3-6 months)\n"
603
- f" - Roll out to additional departments\n"
604
- f" - Begin subscription consolidation\n"
605
- f" - Scale security controls\n\n"
606
  f"\n[Learn more about Preamble solutions and pricing](https://preamble.com/pricing)"
607
  )
608
  return report, comparison
@@ -1411,13 +1441,13 @@ def create_app():
1411
  dept_count = len(updated_departments)
1412
  base_count = total_employees // dept_count
1413
  remainder = total_employees % dept_count
1414
-
1415
  for idx in updated_departments.index:
1416
  if idx < remainder:
1417
  updated_departments.at[idx, 'Number of Employees'] = base_count + 1
1418
  else:
1419
  updated_departments.at[idx, 'Number of Employees'] = base_count
1420
-
1421
  # Adjust to ensure exact total (due to rounding)
1422
  current_sum = updated_departments['Number of Employees'].sum()
1423
  if current_sum != total_employees:
@@ -1430,7 +1460,7 @@ def create_app():
1430
  # If the largest department would go negative, redistribute
1431
  updated_departments.at[largest_dept_idx, 'Number of Employees'] = 1
1432
  remaining_diff = diff + 1 - updated_departments.at[largest_dept_idx, 'Number of Employees']
1433
-
1434
  # Distribute remaining difference across other departments
1435
  for idx in updated_departments.index:
1436
  if idx != largest_dept_idx and remaining_diff != 0:
@@ -1499,37 +1529,37 @@ def create_app():
1499
  org_size_val = int(org_size) if org_size is not None else 90
1500
  except (ValueError, TypeError):
1501
  org_size_val = 90
1502
-
1503
  try:
1504
  monthly_budget_val = float(monthly_budget) if monthly_budget is not None else 30000
1505
  except (ValueError, TypeError):
1506
  monthly_budget_val = 30000.0
1507
-
1508
  try:
1509
  api_calls_val = int(api_calls) if api_calls is not None else 10000
1510
  except (ValueError, TypeError):
1511
  api_calls_val = 10000
1512
-
1513
  try:
1514
  initial_dev_cost_val = float(initial_dev_cost) if initial_dev_cost is not None else 1000000
1515
  except (ValueError, TypeError):
1516
  initial_dev_cost_val = 1000000.0
1517
-
1518
  try:
1519
  num_ai_personnel_val = int(num_ai_personnel) if num_ai_personnel is not None else 1
1520
  except (ValueError, TypeError):
1521
  num_ai_personnel_val = 1
1522
-
1523
  try:
1524
  avg_annual_salary_val = float(avg_annual_salary) if avg_annual_salary is not None else 200000
1525
  except (ValueError, TypeError):
1526
  avg_annual_salary_val = 200000.0
1527
-
1528
  try:
1529
  annual_maintenance_val = float(annual_maintenance) if annual_maintenance is not None else 500000
1530
  except (ValueError, TypeError):
1531
  annual_maintenance_val = 500000.0
1532
-
1533
  try:
1534
  security_compliance_val = float(security_compliance) if security_compliance is not None else 250000
1535
  except (ValueError, TypeError):
 
349
  if has_ai_app:
350
  solution = "Guardrails Only"
351
  monthly_cost = api_calls * 0.005
352
+ description = f"""
353
+ #### ⚑ [Guardrails Only - Compliance](https://preamble.com/pricing)
354
+
355
+ Perfect for integrating with your existing AI application:
356
+ - Quick API integration.
357
+ - Pre-built security and privacy guardrails.
358
+ - Basic compliance templates.
359
+ - Agentless operation.
360
+ - Free Trial available.
361
+ - Free Shadow AI Tool {shadow_ai_blocker}
362
+
363
+ $0.005 per API call (Est. monthly cost: ${monthly_cost:,.2f} at {api_calls:,} calls/month)
364
+
365
+ [Learn more about Preamble pricing options](https://preamble.com/pricing)"""
366
  image = "πŸ›‘οΈ"
367
  else:
368
  solution = "SMB"
369
+ description = f"""
370
+ #### πŸš€ [SMB](https://preamble.com/pricing)
371
+
372
+ Perfect for teams getting started with AI:
373
+ - Full platform features.
374
+ - Standard compliance templates.
375
+ - Protection for up to 25 AI applications.
376
+ - Secure Knowledge Base.
377
+ - SaaS Hosting.
378
+ - Free Shadow AI Tool {shadow_ai_blocker}
379
+
380
+ $50 per user/month
381
+
382
+ [Learn more about Preamble pricing options](https://preamble.com/pricing)"""
383
  image = "🏒"
384
  elif org_size >= 1000 or industry in high_risk_industries:
385
  solution = "Enterprise"
386
+ description = f"""
387
+ #### 🏒 [Enterprise License](https://preamble.com/pricing)
388
+
389
+ Perfect for large or high-risk organizations:
390
+ - Complete compliance controls.
391
+ - Custom AI Assistant Development Support.
392
+ - Dedicated support team.
393
+ - Private AI Marketplace.
394
+ - Custom integrations.
395
+ - Private cloud/on-premise options.
396
+ - Free Shadow AI Tool {shadow_ai_blocker}
397
+
398
+ Starting at $27,000/month with discounts for multi-year deals
399
+
400
+ [Learn more about Preamble pricing options](https://preamble.com/pricing)"""
401
  image = "πŸš€"
402
  elif org_size >= 100:
403
  solution = "SMB"
404
+ description = f"""
405
+ #### πŸš€ [SMB](https://preamble.com/pricing)
406
+
407
+ Perfect for teams getting started with AI:
408
+ - Full platform features.
409
+ - Standard compliance templates.
410
+ - Custom AI Assistants.
411
+ - Safe AI Search Agent
412
+ - Secure Knowledge Base.
413
+ - SaaS Hosting.
414
+ - Free Shadow AI Tool {shadow_ai_blocker}
415
+
416
+ $50 per user/month
417
+
418
+ [Learn more about Preamble pricing options](https://preamble.com/pricing)"""
419
  image = "🏒"
420
 
421
  else:
422
  solution = "Guardrails Only"
423
  monthly_cost = api_calls * 0.005
424
+ description = f"""
425
+ #### ⚑ [Guardrails Only - Compliance](https://preamble.com/pricing)
426
+
427
+ Perfect for integrating with your existing AI application:
428
+ - Quick API integration.
429
+ - Pre-built security and privacy guardrails.
430
+ - Basic compliance templates.
431
+ - Agentless operation.
432
+ - Free Trial available.
433
+ - Free Shadow AI Tool {shadow_ai_blocker}
434
+
435
+ $0.005 per API call (Est. monthly cost: ${monthly_cost:,.2f} at {api_calls:,} calls/month)
436
+
437
+ [Learn more about Preamble pricing options](https://preamble.com/pricing)"""
438
  image = "πŸ›‘οΈ"
439
  return {"solution": solution, "description": description, "image": image}
440
 
 
570
  security_compliance
571
  )
572
 
573
+ dept_recommendations = ""
574
+ for i, dept in enumerate(top_departments):
575
+ dept_recommendations += f"\n{i+1}. **{dept['Department']}** (ROI: {dept['ROI']:.1f}%)\n"
576
+ dept_recommendations += f" - Annual cost savings: ${dept['Annual Cost Savings']:,.2f}\n"
577
+ dept_recommendations += f" - Hours saved annually: {dept['Annual Hours Saved']:,.0f}\n"
578
+ dept_recommendations += " - Top AI use cases:\n"
579
+ for use_case in dept["Use Cases"]:
580
+ dept_recommendations += f" - {use_case}\n"
581
+
582
+ security_text = "\n\n### Key Security Considerations\n"
583
+ for risk in industry_risks:
584
+ security_text += f"- {risk}\n"
585
+
586
+ subscription_text = "\n### Subscription & Tool Optimization\n"
587
+ subscription_text += f"- **Current annual spend:** ${subscription_savings['total_current_cost']:,.2f}\n"
588
+ subscription_text += f"- **Potential annual savings:** ${subscription_savings['total_savings']:,.2f} ({subscription_savings['savings_percentage']:.1f}%)\n"
589
+ subscription_text += "- **Recommendation:** Evaluate consolidation of overlapping tools with AI capabilities\n"
590
+
591
+ compliance_text = "\n### Compliance Risk Reduction\n"
592
+ compliance_text += f"- **Potential risk exposure reduction:** ${compliance_savings['total_savings']:,.2f}\n"
593
+ compliance_text += "- **Key regulations to address:**\n"
594
+ for reg in compliance_savings['key_regulations']:
595
+ compliance_text += f" - {reg['name']}: ${reg['cost']:,.2f} risk exposure\n"
596
+
597
+ build_vs_buy_text = "\n### Build vs Buy Analysis\n"
598
+ build_vs_buy_text += "- **Building in-house:**\n"
599
+ build_vs_buy_text += f" - First year cost: ${comparison['first_year_build']:,.2f}\n"
600
+ build_vs_buy_text += f" - Ongoing annual cost: ${comparison['ongoing_annual_build']:,.2f}\n"
601
+ build_vs_buy_text += f" - 3-year total cost: ${comparison['three_year_build']:,.2f}\n\n"
602
+ build_vs_buy_text += "- **Preamble Enterprise:**\n"
603
+ build_vs_buy_text += f" - Annual cost: ${comparison['annual_preamble']:,.2f}\n"
604
+ build_vs_buy_text += f" - 3-year total cost: ${comparison['three_year_preamble']:,.2f}\n\n"
605
+ build_vs_buy_text += f"- **3-year savings with Preamble:** ${comparison['three_year_savings']:,.2f} ({comparison['savings_percentage']:.1f}%)\n"
606
+ build_vs_buy_text += f"- **ROI:** {((comparison['three_year_savings'] / comparison['three_year_preamble']) * 100):,.1f}%\n"
607
+
608
+ # Improve formatting for Executive Summary with line breaks between items
609
+ executive_summary = "## Executive Summary\n"
610
+ executive_summary += f"- **Industry:** {industry}\n"
611
+ executive_summary += f"- **Organization Size:** {org_size:,} employees\n"
612
+ executive_summary += f"- **Monthly Budget:** ${monthly_budget:,.2f}\n"
613
+ executive_summary += f"- **Existing AI Application:** {'Yes' if has_ai_app else 'No'}\n"
614
+ executive_summary += f"- **Total Potential Annual Savings:** ${total_dept_savings + subscription_savings['total_savings'] + compliance_savings['total_savings']:,.2f}\n\n"
615
+
616
+ # Format implementation roadmap with proper line breaks
617
+ implementation_roadmap = "## Implementation Roadmap\n\n"
618
+ implementation_roadmap += "1. **Phase 1: Security Foundation** (1-2 months)\n"
619
+ implementation_roadmap += f" - Deploy Preamble {solution_rec['solution']}\n"
620
+ implementation_roadmap += " - Establish AI governance framework\n"
621
+ implementation_roadmap += " - Train key personnel\n\n"
622
+ implementation_roadmap += "2. **Phase 2: Department Pilots** (2-3 months)\n"
623
+ implementation_roadmap += f" - Implement AI use cases in {top_departments[0]['Department']}\n"
624
+ implementation_roadmap += " - Measure results\n\n"
625
+ implementation_roadmap += "3. **Phase 3: Expansion** (3-6 months)\n"
626
+ implementation_roadmap += " - Roll out to additional departments\n"
627
+ implementation_roadmap += " - Begin subscription consolidation\n"
628
+ implementation_roadmap += " - Scale security controls\n\n"
629
 
630
  report = (
631
+ f"# AI Implementation & Security Recommendation\n{executive_summary}"
 
 
 
 
632
  f"## Recommended Preamble Solution\n{solution_rec['image']} {solution_rec['description']}\n\n"
633
  f"{build_vs_buy_text}\n"
634
+ f"## Department Recommendations\nThe following departments show the highest potential ROI for AI implementation:{dept_recommendations}\n"
635
+ f"{subscription_text}{compliance_text}{security_text}\n\n{implementation_roadmap}"
 
 
 
 
 
 
 
 
 
 
 
636
  f"\n[Learn more about Preamble solutions and pricing](https://preamble.com/pricing)"
637
  )
638
  return report, comparison
 
1441
  dept_count = len(updated_departments)
1442
  base_count = total_employees // dept_count
1443
  remainder = total_employees % dept_count
1444
+
1445
  for idx in updated_departments.index:
1446
  if idx < remainder:
1447
  updated_departments.at[idx, 'Number of Employees'] = base_count + 1
1448
  else:
1449
  updated_departments.at[idx, 'Number of Employees'] = base_count
1450
+
1451
  # Adjust to ensure exact total (due to rounding)
1452
  current_sum = updated_departments['Number of Employees'].sum()
1453
  if current_sum != total_employees:
 
1460
  # If the largest department would go negative, redistribute
1461
  updated_departments.at[largest_dept_idx, 'Number of Employees'] = 1
1462
  remaining_diff = diff + 1 - updated_departments.at[largest_dept_idx, 'Number of Employees']
1463
+
1464
  # Distribute remaining difference across other departments
1465
  for idx in updated_departments.index:
1466
  if idx != largest_dept_idx and remaining_diff != 0:
 
1529
  org_size_val = int(org_size) if org_size is not None else 90
1530
  except (ValueError, TypeError):
1531
  org_size_val = 90
1532
+
1533
  try:
1534
  monthly_budget_val = float(monthly_budget) if monthly_budget is not None else 30000
1535
  except (ValueError, TypeError):
1536
  monthly_budget_val = 30000.0
1537
+
1538
  try:
1539
  api_calls_val = int(api_calls) if api_calls is not None else 10000
1540
  except (ValueError, TypeError):
1541
  api_calls_val = 10000
1542
+
1543
  try:
1544
  initial_dev_cost_val = float(initial_dev_cost) if initial_dev_cost is not None else 1000000
1545
  except (ValueError, TypeError):
1546
  initial_dev_cost_val = 1000000.0
1547
+
1548
  try:
1549
  num_ai_personnel_val = int(num_ai_personnel) if num_ai_personnel is not None else 1
1550
  except (ValueError, TypeError):
1551
  num_ai_personnel_val = 1
1552
+
1553
  try:
1554
  avg_annual_salary_val = float(avg_annual_salary) if avg_annual_salary is not None else 200000
1555
  except (ValueError, TypeError):
1556
  avg_annual_salary_val = 200000.0
1557
+
1558
  try:
1559
  annual_maintenance_val = float(annual_maintenance) if annual_maintenance is not None else 500000
1560
  except (ValueError, TypeError):
1561
  annual_maintenance_val = 500000.0
1562
+
1563
  try:
1564
  security_compliance_val = float(security_compliance) if security_compliance is not None else 250000
1565
  except (ValueError, TypeError):