Spaces:
Sleeping
Sleeping
Create app.py
Browse files12345678910111213141516171819202122232425import asyncio
from fastapi import FastAPIfrom starlette.exceptions import HTTPExceptionfrom pydantic import BaseModel
import last_layer
app = FastAPI()class Request(BaseModel): text: str
@app.post("/scan-prompt/")async def scan_prompt(chunk: Request) -> last_layer.RiskModel: try: result = await asyncio.to_thread(last_layer.scan_prompt, chunk.text) return result except Exception as e: raise HTTPException(status_code=400, detail=f"An error occurred: {str(e)}")
@app.post("/scan-llm/")async def scan_llm(chunk: Request): return {"message": "None"}app.pyAdded+25