Create libs/ai-services/ with FastAPI app providing: - POST /avm/predict — XGBoost-backed property price prediction (heuristic fallback) - POST /avm/extract-features — Vietnamese NLP feature extraction from listing text - POST /moderation/check — content moderation with rule-based flagging - GET /health — health check endpoint Includes Dockerfile (Python 3.12), docker-compose integration, Pydantic models, and 9 passing tests covering all endpoints. Co-Authored-By: Paperclip <noreply@paperclip.ing>
13 lines
439 B
Python
13 lines
439 B
Python
from fastapi import APIRouter
|
|
|
|
from app.models.moderation import ModerationRequest, ModerationResponse
|
|
from app.services.moderation_service import moderation_service
|
|
|
|
router = APIRouter(prefix="/moderation", tags=["Moderation"])
|
|
|
|
|
|
@router.post("/check", response_model=ModerationResponse)
|
|
def check(req: ModerationRequest) -> ModerationResponse:
|
|
"""Check text content for policy violations."""
|
|
return moderation_service.check(req)
|