Overview

The user interface is what people see and interact with when they visit our Smart Credit Risk System. It's built using HTML forms and styled with CSS to create a clean, modern, and professional look that matches our fintech theme.

index.html - The User Interface

The index.html file contains the frontend of our application. Let's explore its key components:

1. HTML Form Structure

The form collects all the information needed to make a prediction:

<form action="/predict" method="POST"> <label>Age:</label> <input type="number" name="age" required> <label>Annual Income:</label> <input type="number" name="person_income" required> <label>Loan Amount:</label> <input type="number" name="loan_amnt" required> <button type="submit">Predict Risk</button> </form>

How it works:

2. CSS Styling - Modern Card Layout

The CSS creates a beautiful, modern interface with a card-based design:

/* Card container styling */ .form-card { background: white; border-radius: 12px; padding: 2rem; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); max-width: 600px; margin: 2rem auto; } /* Input field styling */ input[type="number"], select { width: 100%; padding: 0.75rem; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 1rem; } input:focus { border-color: #50C878; /* Emerald green */ outline: none; }

The CSS creates:

3. Displaying Results - Template Variables

Flask uses a templating system called Jinja2. We can display dynamic content using double curly braces:

<div class="result"> {% if prediction_text %} <h2>{{ prediction_text }}</h2> <p>Confidence: {{ confidence }}%</p> {% endif %} </div>

💡 How Template Variables Work

When the backend sends data to the template, Flask replaces {{ prediction_text }} with the actual prediction result (like "SAFE - Low Risk" or "RISKY - High Risk").

The {% if %} block ensures the result only shows after a prediction has been made, not when the page first loads.

requirements.txt - The Shopping List

The requirements.txt file is like a shopping list for the deployment server. It tells the server (like Render) exactly which Python libraries to install so our application can run.

What's Inside requirements.txt

Flask==2.3.0 gunicorn==21.2.0 scikit-learn==1.3.0 pandas==2.0.3 joblib==1.3.2 numpy==1.24.3

Each Library Explained:

🔧 How Deployment Works

When you deploy to Render (or similar platforms):

  1. The server reads requirements.txt
  2. It installs all listed libraries using: pip install -r requirements.txt
  3. It starts the Flask app using gunicorn: gunicorn app:app
  4. Your application is now live and accessible via a URL!

Why specify versions? Using exact versions (like Flask==2.3.0) ensures everyone gets the same library versions, preventing compatibility issues.

Deployment Checklist

Before deploying, make sure you have:

Summary

The interface and deployment work together to create a complete, production-ready application: