Spaces:
Sleeping
Sleeping
File size: 452 Bytes
027af44 be2f883 027af44 be2f883 027af44 be2f883 027af44 be2f883 606cabe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from fastapi import FastAPI
from pydantic import BaseModel
from model import predict_testcases # your ML code
app = FastAPI(title="PR Test Case Prioritization API")
# ✅ Define input model first
class PRInput(BaseModel):
pr_title: str
top_k: int = 5
# ✅ Then define endpoint
@app.post("/predict")
def predict(pr: PRInput):
results = predict_testcases(pr.pr_title, pr.top_k)
return {"predictions": results} # return list directly |