File size: 544 Bytes
64a7b70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from fastapi import FastAPI
from pydantic import BaseModel
from pipeline import CodeReviewerPipeline

app = FastAPI(title="AI Code Reviewer")

pipeline = CodeReviewerPipeline()

class CodeRequest(BaseModel):
    code: str

@app.post("/review")
def review_code(request: CodeRequest):
    """
    POST /review
    JSON payload: {"code": "python code string"}
    Returns: JSON review from pipeline
    """
    result = pipeline(request.code)
    return result

@app.get("/")
def root():
    return {"message": "AI Code Reviewer API is running!"}