ifiecas commited on
Commit
e05c734
·
verified ·
1 Parent(s): acd7512

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +186 -37
app.py CHANGED
@@ -324,49 +324,198 @@ with tab1:
324
  """, unsafe_allow_html=True)
325
 
326
  with tab2:
327
- # Add custom CSS to make font sizes consistent
328
  st.markdown("""
329
  <style>
330
- /* Make all text in the About tab the same size */
331
- [data-testid="stAppViewContainer"] .stTabs [aria-label="About the System"] p,
332
- [data-testid="stAppViewContainer"] .stTabs [aria-label="About the System"] li {
333
- font-size: 16px !important;
334
- line-height: 1.5 !important;
335
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  </style>
337
  """, unsafe_allow_html=True)
338
 
339
- # Use regular paragraphs with bold text for titles
340
- st.markdown("**About the Loan Approval System**")
341
- st.write("Our AI-powered system evaluates loan applications using machine learning and industry-standard criteria to analyze your financial information, credit history, and loan requirements.")
342
-
343
- st.markdown("**About the ML Model**")
344
- st.write("""The machine learning model used here is a Decision Tree, which was the best performing model among KNN,
345
- Random Forest, Logistic Regression, and Support Vector Machine models tested.
346
-
347
- The Decision Tree model was further refined using Cost Complexity Pruning (CCP) to find the optimal
348
- alpha value for pruning, which helps prevent overfitting while maintaining high accuracy.""")
 
 
349
 
350
- st.markdown("**Model Performance Metrics:**")
351
- st.markdown("""
352
- - Accuracy: 0.8361
353
- - Precision: 0.8077
354
- - Recall: 1.0000
355
- - F1 Score: 0.8936
356
- """)
 
 
 
 
357
 
358
- st.write("For more information about the modeling process (from loading the dataset to fine-tuning the model), check here: [Coming Soon]")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
 
360
- st.write("Enjoyed doing this and learned a lot! 😊")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
 
362
- st.markdown("**Behind the Build**")
363
- st.markdown("[Ivy Fiecas-Borjal](https://ifiecas.com/)")
364
- st.write("Inspired by an assessment in BCO6008 Predictive Analytics class in Victoria University (Melbourne) with Dr. Omid Ameri Sianaki")
365
-
366
- # Footer with disclaimer
367
- st.markdown("""
368
- <div class="footer-disclaimer">
369
- <p><strong>Educational Project Disclaimer:</strong> This application is a prototype created to demonstrate machine learning model deployment and is not an actual financial service. The loan approval decisions are based on a trained model for educational purposes only and should not be used for real financial decisions.</p>
370
- <p>© 2025 SmartLoanAI - Machine Learning Showcase Project</p>
371
- </div>
372
- """, unsafe_allow_html=True)
 
324
  """, unsafe_allow_html=True)
325
 
326
  with tab2:
327
+ # Add custom CSS for better styling
328
  st.markdown("""
329
  <style>
330
+ /* Main container styling */
331
+ .about-container {
332
+ background-color: #f8f9fa;
333
+ border-radius: 10px;
334
+ padding: 20px;
335
+ margin-bottom: 20px;
336
+ }
337
+
338
+ /* Section styling */
339
+ .about-section {
340
+ margin-bottom: 25px;
341
+ }
342
+
343
+ /* Section headers */
344
+ .section-header {
345
+ color: #1e3a8a;
346
+ font-size: 20px;
347
+ font-weight: 600;
348
+ margin-bottom: 10px;
349
+ border-bottom: 2px solid #e5e7eb;
350
+ padding-bottom: 5px;
351
+ }
352
+
353
+ /* Regular text */
354
+ .about-text {
355
+ font-size: 16px;
356
+ line-height: 1.6;
357
+ color: #374151;
358
+ }
359
+
360
+ /* Metrics card container */
361
+ .metrics-container {
362
+ display: flex;
363
+ flex-wrap: wrap;
364
+ gap: 15px;
365
+ margin: 15px 0;
366
+ }
367
+
368
+ /* Individual metric card */
369
+ .metric-card {
370
+ background-color: white;
371
+ border-radius: 8px;
372
+ padding: 15px;
373
+ min-width: 120px;
374
+ box-shadow: 0 2px 4px rgba(0,0,0,0.05);
375
+ flex: 1;
376
+ text-align: center;
377
+ }
378
+
379
+ /* Metric value */
380
+ .metric-value {
381
+ font-size: 22px;
382
+ font-weight: 600;
383
+ color: #2563eb;
384
+ }
385
+
386
+ /* Metric label */
387
+ .metric-label {
388
+ font-size: 14px;
389
+ color: #6b7280;
390
+ margin-top: 5px;
391
+ }
392
+
393
+ /* Footer styling */
394
+ .footer-disclaimer {
395
+ background-color: #f3f4f6;
396
+ border-radius: 8px;
397
+ padding: 15px;
398
+ margin-top: 30px;
399
+ border-left: 4px solid #9ca3af;
400
+ font-size: 14px;
401
+ color: #4b5563;
402
+ }
403
+
404
+ /* Author bio section */
405
+ .author-bio {
406
+ display: flex;
407
+ align-items: center;
408
+ gap: 15px;
409
+ background-color: white;
410
+ border-radius: 8px;
411
+ padding: 15px;
412
+ margin: 20px 0;
413
+ box-shadow: 0 2px 4px rgba(0,0,0,0.05);
414
+ }
415
+
416
+ /* Author image placeholder */
417
+ .author-image {
418
+ width: 60px;
419
+ height: 60px;
420
+ border-radius: 50%;
421
+ background-color: #e5e7eb;
422
+ display: flex;
423
+ align-items: center;
424
+ justify-content: center;
425
+ color: #9ca3af;
426
+ font-size: 20px;
427
+ font-weight: bold;
428
+ }
429
  </style>
430
  """, unsafe_allow_html=True)
431
 
432
+ # Main content container
433
+ st.markdown('<div class="about-container">', unsafe_allow_html=True)
434
+
435
+ # System overview section
436
+ st.markdown('<div class="about-section">', unsafe_allow_html=True)
437
+ st.markdown('<h2 class="section-header">About the Loan Approval System</h2>', unsafe_allow_html=True)
438
+ st.markdown(
439
+ '<p class="about-text">Our AI-powered system evaluates loan applications using machine learning and '
440
+ 'industry-standard criteria. It analyzes your financial information, credit history, and loan requirements '
441
+ 'to provide fast, objective loan decisions.</p>', unsafe_allow_html=True
442
+ )
443
+ st.markdown('</div>', unsafe_allow_html=True)
444
 
445
+ # Model information section
446
+ st.markdown('<div class="about-section">', unsafe_allow_html=True)
447
+ st.markdown('<h2 class="section-header">About the ML Model</h2>', unsafe_allow_html=True)
448
+ st.markdown(
449
+ '<p class="about-text">The machine learning model powering this system is a Decision Tree classifier, '
450
+ 'which outperformed several alternatives including KNN, Random Forest, Logistic Regression, and Support '
451
+ 'Vector Machine in our testing phase. The model was refined using Cost Complexity Pruning (CCP) to identify '
452
+ 'the optimal alpha value, preventing overfitting while maintaining high predictive accuracy.</p>',
453
+ unsafe_allow_html=True
454
+ )
455
+ st.markdown('</div>', unsafe_allow_html=True)
456
 
457
+ # Performance metrics section with cards
458
+ st.markdown('<div class="about-section">', unsafe_allow_html=True)
459
+ st.markdown('<h2 class="section-header">Model Performance Metrics</h2>', unsafe_allow_html=True)
460
+
461
+ # Metrics cards using HTML for better styling
462
+ st.markdown(
463
+ '<div class="metrics-container">'
464
+ ' <div class="metric-card">'
465
+ ' <div class="metric-value">83.61%</div>'
466
+ ' <div class="metric-label">Accuracy</div>'
467
+ ' </div>'
468
+ ' <div class="metric-card">'
469
+ ' <div class="metric-value">80.77%</div>'
470
+ ' <div class="metric-label">Precision</div>'
471
+ ' </div>'
472
+ ' <div class="metric-card">'
473
+ ' <div class="metric-value">100.00%</div>'
474
+ ' <div class="metric-label">Recall</div>'
475
+ ' </div>'
476
+ ' <div class="metric-card">'
477
+ ' <div class="metric-value">89.36%</div>'
478
+ ' <div class="metric-label">F1 Score</div>'
479
+ ' </div>'
480
+ '</div>',
481
+ unsafe_allow_html=True
482
+ )
483
+
484
+ # Link to documentation/more info
485
+ st.markdown(
486
+ '<p class="about-text">For more information about the modeling process (from loading the dataset to fine-tuning '
487
+ 'the model), check here: <a href="#" style="color: #2563eb;">Documentation</a> (Coming Soon)</p>',
488
+ unsafe_allow_html=True
489
+ )
490
+ st.markdown('</div>', unsafe_allow_html=True)
491
 
492
+ # Author section with profile
493
+ st.markdown('<div class="about-section">', unsafe_allow_html=True)
494
+ st.markdown('<h2 class="section-header">Behind the Build</h2>', unsafe_allow_html=True)
495
+
496
+ st.markdown(
497
+ '<div class="author-bio">'
498
+ ' <div class="author-image">IF</div>'
499
+ ' <div>'
500
+ ' <p style="margin: 0; font-weight: 600; color: #1f2937;">Ivy Fiecas-Borjal</p>'
501
+ ' <p style="margin: 0; font-size: 14px; color: #6b7280;">Data Scientist & Developer</p>'
502
+ ' <p style="margin-top: 5px; font-size: 14px;">'
503
+ ' <a href="https://ifiecas.com/" target="_blank" style="color: #2563eb; text-decoration: none;">Visit Portfolio</a>'
504
+ ' </p>'
505
+ ' </div>'
506
+ '</div>',
507
+ unsafe_allow_html=True
508
+ )
509
+
510
+ st.markdown(
511
+ '<p class="about-text">Inspired by an assessment in BCO6008 Predictive Analytics class in Victoria University '
512
+ '(Melbourne) with Dr. Omid Ameri Sianaki. Enjoyed doing this and learned a lot! 😊</p>',
513
+ unsafe_allow_html=True
514
+ )
515
+ st.markdown('</div>', unsafe_allow_html=True)
516
 
517
+ # Disclaimer footer
518
+ st.markdown("""<div class="footer-disclaimer">
519
+ <p><strong>Educational Project Disclaimer:</strong> This application is a prototype created to demonstrate machine learning model deployment and is not an actual financial service. The loan approval decisions are based on a trained model for educational purposes only and should not be used for real financial decisions.</p>
520
+ <p>© 2025 SmartLoanAI - Machine Learning Showcase Project</p>
521
+ </div>""", unsafe_allow_html=True)