simpler health check

This commit is contained in:
matatonic 2023-12-01 14:33:13 -05:00
parent efed057896
commit 98c102d0ef

12
main.py
View file

@ -7,7 +7,7 @@ import subprocess
import tempfile import tempfile
import yaml import yaml
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.responses import StreamingResponse, JSONResponse from fastapi.responses import StreamingResponse, Response
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
import uvicorn import uvicorn
from pydantic import BaseModel from pydantic import BaseModel
@ -57,13 +57,11 @@ app.add_middleware(
allow_headers=["*"] allow_headers=["*"]
) )
@app.get("/livez") @app.get("/")
async def livez(): @app.head("/")
return "OK"
@app.options("/") @app.options("/")
async def options(): async def root() -> Response:
return JSONResponse(content="OK") return Response(status_code=200, content="", media_type="text/plain")
class GenerateSpeechRequest(BaseModel): class GenerateSpeechRequest(BaseModel):
model: str = "tts-1" # or "tts-1-hd" model: str = "tts-1" # or "tts-1-hd"