Skip to content

Modal Configuration

ModalApp

This module defines the modal integration and the code to be run in Modal's container.

Attributes:

Name Type Description
LOGGER Logger

Module's logging object.

MODAL_IMAGE str

Docker Repository URL for pre-built Image acquired from environment variable. Defaults to docker.io/svdc1/mirumoji-modal-gpu:latest

GPU str

Which Modal GPU to use from environment variable. Defaults to A10G

transcribe_srt_job(media_fp, fwhisper_kwargs={}, transcribe_kwargs={}, fix_with_chat_gpt=True)

Runs Whisper transcription on media_fp, fixes with GPT, and returns SRT string.

Parameters:

Name Type Description Default
media_fp Union[str, Path]

Path to the video for transcription.

required
fwhisper_kwargs dict

Additional arguments for FWhisperWrapper

{}
transcribe_kwargs dict

Additional arguments for FWhisperWrapper.transcribe

{}
fix_with_chat_gpt bool

If True request ChatGPT to fix transcription. Defaults to True

True

Returns:

Name Type Description
str Union[str, None]

Transcription in form of SRT string.

transcribe_to_string_job(audio_fp, fwhisper_kwargs={}, transcribe_kwargs={})

Transcribe audio to string using Faster Whisper.

Parameters:

Name Type Description Default
audio_fp Union[str, Path]

Path to the audio for transcription.

required
fwhisper_kwargs dict

Additional arguments for FWhisperWrapper

{}
transcribe_kwargs dict

Additional arguments for FWhisperWrapper.transcribe

{}

Returns:

Name Type Description
str Union[str, None]

Transcription in form of string.

video_conversion_job(video_fp, to_mp4_kwargs={})

Converts video_fp to MP4 using NVENC and returns the video content as bytes.

Parameters:

Name Type Description Default
video_fp Union[str, Path]

Path to the video for conversion.

required
to_mp4_kwargs dict

Additional arguments for AudioTools.to_mp4.

{}

Yields:

Name Type Description
bytes bytes

The converted video chunks.