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
|
GPU |
str
|
Which Modal GPU to use from environment variable.
Defaults to |
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
|
{}
|
transcribe_kwargs
|
dict
|
Additional arguments for
|
{}
|
fix_with_chat_gpt
|
bool
|
If |
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
|
{}
|
transcribe_kwargs
|
dict
|
Additional arguments for
|
{}
|
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
|
{}
|
Yields:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
The converted video chunks. |