This commit is contained in:
2026-01-07 10:40:22 +01:00
parent b5d5195f8f
commit 56b4e056c3
2 changed files with 405 additions and 2 deletions

12
api.py
View File

@@ -23,8 +23,8 @@ MODEL_CACHE = {}
# --- Pydantic Models ---
class PredictRequest(BaseModel):
prompt: str
temperature: float = 0.7
n: int = 3
temperature: float = 1.6
n: int = 4
length: int = 5
@@ -84,6 +84,14 @@ async def predict(request: PredictRequest):
return PredictResponse(prediction=prediction)
@app.get("/api")
async def api_docs():
"""
API documentation page.
"""
return FileResponse(os.path.join(UI_DIR, "api.html"))
# --- Static Files and Root ---
app.mount("/ui", StaticFiles(directory=UI_DIR), name="ui")