transcript¶
Transcript generation module for Direktor.
direktor.core.transcript
¶
Transcript generation module for Direktor.
This module handles podcast script generation and audio transcription.
aggregate_chunks(chunks, target_duration=30)
¶
Aggregate transcript chunks into segments of approximately target duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chunks
|
list[dict[str, Any]]
|
List of transcript chunks with |
required |
target_duration
|
int
|
Target duration in seconds for each segment. |
30
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of aggregated chunks. |
Source code in direktor/core/transcript.py
generate_podcast_script(input_text, temp_dir)
¶
Generate a podcast script from input text using GPT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_text
|
str
|
The text to convert into a podcast script. |
required |
temp_dir
|
str | PathLike[str]
|
Temporary directory for output files. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The generated podcast script. |
Source code in direktor/core/transcript.py
generate_transcript(audio_file, temp_dir)
¶
Generate a transcript from an audio file using Whisper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio_file
|
str | PathLike[str]
|
Path to the audio file. |
required |
temp_dir
|
str | PathLike[str]
|
Temporary directory for intermediate files. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Transcript dictionary with chunks and timestamps. |
Raises:
| Type | Description |
|---|---|
TranscriptGenerationError
|
If transcription fails. |