Loan_ml_project/docs/api-reference.md

45 lines
1.3 KiB
Markdown

# API Reference
## Endpoints
### GET /
Returns the home page HTML.
### GET /predict
Returns the prediction form HTML.
### POST /predict
Predicts loan approval status based on the provided applicant information.
**Request Parameters**
| Parameter | Type | Description |
|-----------|------|-------------|
| Gender | int | Gender of the applicant (0 for Female, 1 for Male) |
| Married | int | Marital status (0 for No, 1 for Yes) |
| Dependents | int | Number of dependents (0, 1, 2, or 3+) |
| Education | int | Education level (0 for Not Graduate, 1 for Graduate) |
| Self_Employed | int | Self-employment status (0 for No, 1 for Yes) |
| ApplicantIncome | float | Applicant's income |
| CoapplicantIncome | float | Co-applicant's income |
| LoanAmount | float | Loan amount in thousands |
| Loan_Amount_Term | int | Term of loan in months |
| Credit_History | int | Credit history (0 for No, 1 for Yes) |
| Property_Area | int | Area of property (0 for Rural, 1 for Semiurban, 2 for Urban) |
**Response**
The response is an HTML page with the prediction result:
- "Approved" if the loan is predicted to be approved
- "Not Approved" if the loan is predicted to be rejected
## Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests.
- 200: Success
- 500: Server error