Skip to content

Commit

Permalink
add logger function
Browse files Browse the repository at this point in the history
  • Loading branch information
jhj0517 committed Jul 6, 2024
1 parent ed1bcd6 commit 5aadb59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]):
Expand Down Expand Up @@ -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),
Expand Down
8 changes: 8 additions & 0 deletions modules/utils/logger.py
Original file line number Diff line number Diff line change
@@ -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)

Expand Down

0 comments on commit 5aadb59

Please sign in to comment.