mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
feat: log
This commit is contained in:
@ -4,8 +4,6 @@ from typing import Any, Coroutine
|
||||
from fastapi import Request, Response, status
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from ..log.log import Logger
|
||||
|
||||
from ..asr.rapid_paraformer.utils import read_yaml
|
||||
from ..asr.rapid_paraformer import RapidParaformer
|
||||
from .blackbox import Blackbox
|
||||
@ -15,8 +13,7 @@ from injector import singleton, inject
|
||||
class ASR(Blackbox):
|
||||
|
||||
@inject
|
||||
def __init__(self,logger: Logger,path = ".env.yaml") -> None:
|
||||
logger.info("ASR init")
|
||||
def __init__(self,path = ".env.yaml") -> None:
|
||||
config = read_yaml(path)
|
||||
self.paraformer = RapidParaformer(config)
|
||||
|
||||
@ -38,6 +35,7 @@ class ASR(Blackbox):
|
||||
async def fast_api_handler(self, request: Request) -> Response:
|
||||
data = (await request.form()).get("audio")
|
||||
if data is None:
|
||||
self.logger.warn("asr bag request","type", "fast_api_handler", "api", "asr")
|
||||
return JSONResponse(content={"error": "data is required"}, status_code=status.HTTP_400_BAD_REQUEST)
|
||||
d = await data.read()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user