👍️[Update] All : 不要なprintLogを削除 / なるべくtry exceptした場合にはerrorLogを保存するように変更
This commit is contained in:
@@ -3,6 +3,7 @@ from io import BytesIO
|
||||
from threading import Event
|
||||
import wave
|
||||
from speech_recognition import Recognizer, AudioData, AudioFile
|
||||
from speech_recognition.exceptions import UnknownValueError
|
||||
from datetime import timedelta
|
||||
from pyaudiowpatch import get_sample_size, paInt16
|
||||
from .transcription_languages import transcription_lang
|
||||
@@ -11,6 +12,8 @@ from .transcription_whisper import getWhisperModel, checkWhisperWeight
|
||||
import torch
|
||||
import numpy as np
|
||||
from pydub import AudioSegment
|
||||
from utils import errorLogging
|
||||
|
||||
import warnings
|
||||
warnings.simplefilter('ignore', RuntimeWarning)
|
||||
|
||||
@@ -74,9 +77,10 @@ class AudioTranscriber:
|
||||
if s.avg_logprob < avg_logprob or s.no_speech_prob > no_speech_prob:
|
||||
continue
|
||||
text += s.text
|
||||
|
||||
except Exception:
|
||||
except UnknownValueError:
|
||||
pass
|
||||
except Exception:
|
||||
errorLogging()
|
||||
finally:
|
||||
pass
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ from typing import Callable
|
||||
import huggingface_hub
|
||||
from faster_whisper import WhisperModel
|
||||
import logging
|
||||
from utils import printLog
|
||||
|
||||
logger = logging.getLogger('faster_whisper')
|
||||
logger.setLevel(logging.CRITICAL)
|
||||
@@ -40,10 +39,8 @@ def downloadFile(url, path, func=None):
|
||||
if isinstance(func, Callable):
|
||||
total_chunk += len(chunk)
|
||||
func(total_chunk/file_size)
|
||||
printLog(f"Downloading Whisper Model: {total_chunk/file_size:.0%}")
|
||||
|
||||
except Exception as e:
|
||||
printLog("warning:downloadFile()", e)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def checkWhisperWeight(root, weight_type):
|
||||
path = os_path.join(root, "weights", "whisper", weight_type)
|
||||
|
||||
Reference in New Issue
Block a user