From 5aadb59d4d4ef4f6e2bf80157237c90981c4d1dd Mon Sep 17 00:00:00 2001 From: jhj0517 <97279763+jhj0517@users.noreply.github.com> Date: Sat, 6 Jul 2024 21:44:50 +0900 Subject: [PATCH] add logger function --- backend/server.py | 12 ++++++------ modules/utils/logger.py | 8 ++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/backend/server.py b/backend/server.py index fb65f70c..26564e35 100644 --- a/backend/server.py +++ b/backend/server.py @@ -24,7 +24,7 @@ import io from modules.whisper.faster_whisper_inference import FasterWhisperInference -from modules.utils.logger import get_logger +from modules.utils.logger import get_backend_logger from modules.vad.silero_vad import SileroVAD from modules.diarize.diarizer import Diarizer from modules.diarize.audio_loader import SAMPLE_RATE @@ -41,7 +41,7 @@ vad_inferencer = None whisper_inferencer = None diarization_inferencer = None -logger = get_logger("Whisper-WebUI-Backend") +logger = get_backend_logger() def format_stream_result(generator: Generator[dict[str, Any], Any, None]): @@ -163,10 +163,10 @@ async def diarization( async def transcription( file: UploadFile = File(default=None, description="Input file for video or audio. This will be pre-processed with ffmpeg in the server"), file_url: str = Form(default=None, description="Input file url for video or audio. You need to provide either the file or the file URL, but not both"), - response_format: str = Form(default="json"), - model_size: str = Form(default="large-v2"), - language: Optional[str] = Form(default=None), - task: str = Form(default="transcribe"), + response_format: str = Form(default="json", description="Response format between [\"json\", \"stream\"]"), + model_size: str = Form(default="large-v2", description="Model sizes for faster-whisper."), + language: Optional[str] = Form(default=None, description="Source language of the input. Automatically detected if it's not provided."), + task: str = Form(default="transcribe", description="Tasks between "), beam_size: int = Form(default=5), best_of: int = Form(default=5), patience: float = Form(default=1), diff --git a/modules/utils/logger.py b/modules/utils/logger.py index 15a2bce4..ff033eb4 100644 --- a/modules/utils/logger.py +++ b/modules/utils/logger.py @@ -1,6 +1,14 @@ import logging +def get_backend_logger(): + return get_logger("Whisper-WebUI-Backend") + + +def get_gradio_logger(): + return get_logger("Whisper-WebUI") + + def get_logger(name: str): logger = logging.getLogger(name)