Spaces:
Sleeping
Sleeping
Download app.py from pr-ml-inference/Test: direct link, hf CLI and curl.
- Browser
- Download file 452 Bytes
-
https://huggingface.co/spaces/pr-ml-inference/Test/resolve/main/app.py
- Command line
-
hf download hf://spaces/pr-ml-inference/Test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/pr-ml-inference/Test/resolve/main/app.py
452 Bytes
| 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 | |
| def predict(pr: PRInput): | |
| results = predict_testcases(pr.pr_title, pr.top_k) | |
| return {"predictions": results} # return list directly |