ml_project/docs/api-reference.md

45 lines
682 B
Markdown

# API Reference
## Endpoints
### GET /
Returns the home page HTML.
### GET /predict
Returns the prediction form HTML.
### POST /predict
Predicts test scores based on the provided study hours.
**Request Body**
```json
{
"hours_studied": 5.5
}
```
| Parameter | Type | Description |
|-----------|------|-------------|
| hours_studied | float | Number of hours studied |
**Response**
```json
{
"predicted_test_score": 85.6
}
```
## Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests.
- 200: Success
- 400: Bad request (e.g., negative hours studied)
- 500: Server error
- 503: Service unavailable (model not loaded)