Spaces:
Sleeping
Sleeping
Download app/main.py from coderMayank69/Synapse_Code_Auditor: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/coderMayank69/Synapse_Code_Auditor/resolve/dcc7e469e96dcc6ef303a866b273dd28fa2baf53/app/main.py
- Command line
-
hf download hf://spaces/coderMayank69/Synapse_Code_Auditor@dcc7e469e96dcc6ef303a866b273dd28fa2baf53/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/coderMayank69/Synapse_Code_Auditor/resolve/dcc7e469e96dcc6ef303a866b273dd28fa2baf53/app/main.py
1.28 kB
| from fastapi import FastAPI, HTTPException | |
| from app.env import AICodeReviewEnvironment | |
| from app.models import ResetRequest, ResetResponse, StateResponse, StepRequest, StepResult | |
| app = FastAPI( | |
| title="Synapse Code Auditor", | |
| description="OpenEnv-compatible environment for deterministic AI code review evaluation.", | |
| version="1.0.0", | |
| ) | |
| env = AICodeReviewEnvironment() | |
| def health() -> dict[str, str]: | |
| return {"status": "healthy", "service": "synapse-code-auditor"} | |
| def reset(request: ResetRequest | None = None) -> ResetResponse: | |
| request = request or ResetRequest() | |
| try: | |
| observation = env.reset(task_id=request.task_id, seed=request.seed) | |
| except KeyError as exc: | |
| raise HTTPException(status_code=400, detail=str(exc)) from exc | |
| return ResetResponse(observation=observation, state=env.state()) | |
| def step(request: StepRequest) -> StepResult: | |
| try: | |
| return env.step(request.action) | |
| except ValueError as exc: | |
| raise HTTPException(status_code=400, detail=str(exc)) from exc | |
| def state() -> StateResponse: | |
| return StateResponse(state=env.state()) | |