Spaces:
Sleeping
Sleeping
File size: 832 Bytes
019e7db c1f42b0 019e7db c1f42b0 019e7db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | """FastAPI backend for the AI-powered Python code review platform."""
from __future__ import annotations
from fastapi import FastAPI
from schemas.request import AnalyzeCodeRequest
from schemas.response import AnalyzeCodeResponse
from services.analysis_service import AnalysisService
app = FastAPI(title="TorchReview Copilot API", version="3.0.0")
analysis_service = AnalysisService()
@app.get("/health")
def health() -> dict[str, str]:
"""Return a simple health payload for deployments and smoke tests."""
return {"status": "ok"}
@app.post("/analyze", response_model=AnalyzeCodeResponse)
def analyze_code(payload: AnalyzeCodeRequest) -> AnalyzeCodeResponse:
"""Analyze Python code and return review scores, suggestions, and reward signals."""
return analysis_service.analyze(payload)
|