mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
This commit restore the original behavior with frame cutting. While silero is used on our gpu for files, look like it's not working great on the live pipeline. To be investigated, but at the moment, what we keep is: - refactored to extract the downscale for further processing in the pipeline - remove any downscale implementation from audio_chunker and audio_merge - removed batching from audio_merge too for now
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import importlib
|
|
|
|
from reflector.processors.audio_chunker import AudioChunkerProcessor
|
|
from reflector.settings import settings
|
|
|
|
|
|
class AudioChunkerAutoProcessor(AudioChunkerProcessor):
|
|
_registry = {}
|
|
|
|
@classmethod
|
|
def register(cls, name, kclass):
|
|
cls._registry[name] = kclass
|
|
|
|
def __new__(cls, name: str | None = None, **kwargs):
|
|
if name is None:
|
|
name = settings.AUDIO_CHUNKER_BACKEND
|
|
if name not in cls._registry:
|
|
module_name = f"reflector.processors.audio_chunker_{name}"
|
|
importlib.import_module(module_name)
|
|
|
|
# gather specific configuration for the processor
|
|
# search `AUDIO_CHUNKER_BACKEND_XXX_YYY`, push to constructor as `backend_xxx_yyy`
|
|
config = {}
|
|
name_upper = name.upper()
|
|
settings_prefix = "AUDIO_CHUNKER_"
|
|
config_prefix = f"{settings_prefix}{name_upper}_"
|
|
for key, value in settings:
|
|
if key.startswith(config_prefix):
|
|
config_name = key[len(settings_prefix) :].lower()
|
|
config[config_name] = value
|
|
|
|
return cls._registry[name](**config | kwargs)
|