Skip to content

Commit e680b20

Browse files
authored
Add support for generator_default on redacting audio (#59)
* adding generator_default to audio file redaction * removing reference to mp4 * update version
1 parent 754c0fa commit e680b20

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

docs/source/redact/redacting_audio.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ Note that calling this method requires that pydub be installed in addition to th
3535

3636
Additional Remarks
3737
------------------
38-
When using the Textual Cloud (https://textual.tonic.ai) file uploads are limited to 25MB or less. Supported file types are m4a, mp3, webm, mp4, mpga, wav.
38+
When using the Textual Cloud (https://textual.tonic.ai) file uploads are limited to 25MB or less. Supported file types are m4a, mp3, webm, mpga, wav.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tonic-textual"
3-
version = "3.10.3"
3+
version = "3.10.4"
44
description = "Wrappers around the Tonic Textual API"
55
authors = ["Adam Kamor <[email protected]>", "Joe Ferrara <[email protected]>", "Ander Steele <[email protected]>", "Ethan Philpott <[email protected]>", "Lyon Van Voorhis <[email protected]>", "Kirill Medvedev <[email protected]>", "Travis Matthews <[email protected]>"]
66
license = "MIT"

tonic_textual/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.10.2"
1+
__version__ = "3.10.4"

tonic_textual/redact_api.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def redact_audio(
247247
num_retries: Optional[int] = 30,
248248
wait_between_retries: Optional[int] = 10,
249249
) -> RedactionResponse:
250-
"""Redacts the transcription from the provided audio file. Supports m4a, mp3, webm, mp4, mpga, wav. Limited to 25MB or less per API call.
250+
"""Redacts the transcription from the provided audio file. Supports m4a, mp3, webm, mpga, wav. Limited to 25MB or less per API call.
251251
Parameters
252252
----------
253253
file_path : str
@@ -384,7 +384,7 @@ def get_audio_transcription(
384384
num_retries: Optional[int] = 30,
385385
wait_between_retries: Optional[int] = 10,
386386
) -> TranscriptionResult:
387-
"""Redacts the transcription from the provided audio file. Supports m4a, mp3, webm, mp4, mpga, wav. Limited to 25MB or less per API call.
387+
"""Redacts the transcription from the provided audio file. Supports m4a, mp3, webm, mpga, wav. Limited to 25MB or less per API call.
388388
Parameters
389389
----------
390390
file_path : str
@@ -458,6 +458,7 @@ def redact_audio_file(
458458
self,
459459
audio_file_path: str,
460460
output_file_path: str,
461+
generator_default: PiiState = PiiState.Redaction,
461462
generator_config: Dict[str, PiiState] = dict(),
462463
label_block_lists: Optional[Dict[str, List[str]]] = None,
463464
label_allow_lists: Optional[Dict[str, List[str]]] = None,
@@ -471,17 +472,22 @@ def redact_audio_file(
471472
----------
472473
audio_file_path : str
473474
The path to the input audio file.
474-
Supported file types are wav, mp3, ogg, flv, mp4, wma, aac, and others. See
475+
Supported file types are wav, mp3, ogg, flv, wma, aac, and others. See
475476
https://github.com/jiaaro/pydub for complete information on file types
476477
supported.
477478
478479
output_file_path : str
479480
The path to save the redacted output file. The output file path specifies
480481
the audio file type that the output is written as via it's extension.
481-
Supported file types are wav, mp3, ogg, flv, mp4, wma, and aac. See
482+
Supported file types are wav, mp3, ogg, flv, wma, and aac. See
482483
https://github.com/jiaaro/pydub for complete information on file types
483484
supported.
484-
485+
486+
generator_default: PiiState = PiiState.Redaction
487+
The default redaction used for types that are not specified in
488+
generator_config. Value must be one of "Redaction", "Synthesis", or
489+
"Off".
490+
485491
generator_config: Dict[str, PiiState]
486492
A dictionary of sensitive data entities. For each entity, indicates
487493
whether to redact, synthesize, or ignore it. Values must be one of
@@ -530,7 +536,7 @@ def redact_audio_file(
530536
transcription = self.get_audio_transcription(audio_file_path)
531537
de_id_res = self.redact(
532538
transcription.text,
533-
generator_default=PiiState.Redaction,
539+
generator_default=generator_default,
534540
generator_config=generator_config,
535541
generator_metadata=dict(),
536542
random_seed=None,

0 commit comments

Comments
 (0)