API page
This commit is contained in:
12
api.py
12
api.py
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user