Skip to content

SOTA Open Source TTS

Add method GET on route `/health` (#886)

Pandedec0677738b3a7
diff --git a/tools/server/views.py b/tools/server/views.py
index 8041515..905f6ad 100644
--- a/tools/server/views.py
+++ b/tools/server/views.py
@@ -7,7 +7,15 @@ import numpy as np
import ormsgpack
import soundfile as sf
import torch
-from kui.asgi import Body, HTTPException, JSONResponse, Routes, StreamResponse, request
+from kui.asgi import (
+ Body,
+ HTTPException,
+ HttpView,
+ JSONResponse,
+ Routes,
+ StreamResponse,
+ request,
+)
from loguru import logger
from typing_extensions import Annotated
@@ -40,9 +48,15 @@ MAX_NUM_SAMPLES = int(os.getenv("NUM_SAMPLES", 1))
routes = Routes()
[email protected]("/v1/health")
-async def health():
- return JSONResponse({"status": "ok"})
[email protected]("/v1/health")
+class Health(HttpView):
+ @classmethod
+ async def get(cls):
+ return JSONResponse({"status": "ok"})
+
+ @classmethod
+ async def post(cls):
+ return JSONResponse({"status": "ok"})
@routes.http.post("/v1/vqgan/encode")