curl --request POST \
--url https://api.example.com/predict \
--header 'Content-Type: application/json' \
--data '
{
"student_country": "<string>",
"days_on_platform": 123,
"minutes_watched": 123,
"courses_started": 123,
"practice_exams_started": 123,
"practice_exams_passed": 123,
"minutes_spent_on_exams": 123
}
'{
"predicted_purchase_probability": 123,
"predicted_purchase": 123
}curl --request POST \
--url https://api.example.com/predict \
--header 'Content-Type: application/json' \
--data '
{
"student_country": "<string>",
"days_on_platform": 123,
"minutes_watched": 123,
"courses_started": 123,
"practice_exams_started": 123,
"practice_exams_passed": 123,
"minutes_spent_on_exams": 123
}
'{
"predicted_purchase_probability": 123,
"predicted_purchase": 123
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/RaviTejaMedarametla/Data-Science-AI-Portfolio/llms.txt
Use this file to discover all available pages before exploring further.
POST /predict
min_length=2, max_length=64>= 0>= 0.0>= 0>= 0>= 0Business Rule: Cannot exceed practice_exams_started>= 0.01 for predicted purchase, 0 for no purchase.Determined by comparing probability against the trained threshold.curl -X POST "http://localhost:8000/predict" \
-H "Content-Type: application/json" \
-H "accept: application/json" \
-d '{
"student_country": "United States",
"days_on_platform": 45,
"minutes_watched": 320.5,
"courses_started": 3,
"practice_exams_started": 5,
"practice_exams_passed": 3,
"minutes_spent_on_exams": 87.2
}'
{
"predicted_purchase_probability": 0.7834,
"predicted_purchase": 1
}
{
"detail": "practice_exams_passed cannot exceed practice_exams_started."
}
{
"detail": "Model is not loaded."
}
src/api.py:284-289
Request Model: PredictRequest (src/api.py:27-34)
class PredictRequest(BaseModel):
student_country: str = Field(..., min_length=2, max_length=64)
days_on_platform: int = Field(..., ge=0)
minutes_watched: float = Field(..., ge=0)
courses_started: int = Field(..., ge=0)
practice_exams_started: int = Field(..., ge=0)
practice_exams_passed: int = Field(..., ge=0)
minutes_spent_on_exams: float = Field(..., ge=0)
PredictResponse (src/api.py:37-39)
class PredictResponse(BaseModel):
predicted_purchase_probability: float
predicted_purchase: int
src/features.py:
practice_exams_passed / (practice_exams_started + epsilon)minutes_watched / (days_on_platform + epsilon)artifacts/prediction_log.jsonl with timestamp and features/monitoring/drift endpoint