Pipeline
audawispr.pipeline.Pipeline
Pipeline(
output,
*,
language="fr",
ipa=False,
model_size="small",
device="auto",
compute_type="int8",
vad=True,
pause_split_ms=700,
min_duration_ms=600,
max_duration_ms=7000,
translation_provider="none",
deck_name=None,
keep_work=False,
)
Narrow public API for running the full audawispr pipeline.
Usage::
from pathlib import Path
from audawispr import Pipeline
Pipeline(
output=Path("deck.apkg"),
language="fr",
ipa=True,
).run(Path("lesson.mp3"))
Parameters:
-
output(Path) –Output path (
.apkgfor Anki package, directory for CSV). -
language(str, default:'fr') –Source language code passed to faster-whisper (e.g.
"fr","en","ja","de"). -
ipa(bool, default:False) –Generate IPA phonetic transcription (French only).
-
model_size(str, default:'small') –faster-whisper model size. One of
"tiny","base","small","medium","large-v3". -
device(str, default:'auto') –Device for Whisper inference.
"auto"selects CUDA when available, else CPU. -
compute_type(str, default:'int8') –Compute type for Whisper.
"int8","float16", or"float32". -
vad(bool, default:True) –Enable voice activity detection filtering.
-
pause_split_ms(int, default:700) –Pause duration (ms) triggering a segment split.
-
min_duration_ms(int, default:600) –Minimum segment duration (ms).
-
max_duration_ms(int, default:7000) –Maximum segment duration (ms).
-
translation_provider(str, default:'none') –Translation provider.
"none"(default) skips translation. -
deck_name(str | None, default:None) –Anki deck name. Defaults to
"audawispr::{language}". -
keep_work(bool, default:False) –Keep working directory after completion.
Source code in src/audawispr/pipeline.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
run
run(audio, *, progress=None, cancel=None)
Run the pipeline for the given audio file.
Parameters:
-
audio(Path) –Path to the input audio file.
-
progress(ProgressHook | None, default:None) –Optional callback receiving a
ProgressEventfor each pipeline phase. -
cancel(CancellationToken | None, default:None) –Optional :class:
CancellationTokenfor cooperative cancellation.
Returns:
-
PipelineResult–:class:
PipelineResultwithoutput_pathandwork_dir.
Source code in src/audawispr/pipeline.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
PipelineResult
audawispr.pipeline.PipelineResult
dataclass
PipelineResult(output_path, work_dir)
Result of a completed pipeline run.
CancellationToken
audawispr.pipeline.CancellationToken
CancellationToken()
Cooperative cancellation checked between phases.
Source code in src/audawispr/core/pipeline.py
49 50 | |
request_cancel
request_cancel()
Request cancellation of the pipeline run.
Source code in src/audawispr/core/pipeline.py
52 53 54 | |
check
check()
Raise CancelledError if cancellation was requested.
Source code in src/audawispr/core/pipeline.py
56 57 58 59 | |
ProgressHook
ProgressHook = Callable[[ProgressEvent], None]