Skip to content

Instantly share code, notes, and snippets.

@patrickloeber
Last active April 28, 2024 14:11
Show Gist options
  • Select an option

  • Save patrickloeber/b2f07d03875961ccbb5d262644325329 to your computer and use it in GitHub Desktop.

Select an option

Save patrickloeber/b2f07d03875961ccbb5d262644325329 to your computer and use it in GitHub Desktop.
import assemblyai as aai
aai.settings.api_key = "API_KEY"
audio_url = "https://github.com/AssemblyAI-Examples/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3"
config = aai.TranscriptionConfig().set_redact_pii(
policies=[
aai.PIIRedactionPolicy.person_name,
aai.PIIRedactionPolicy.organization,
aai.PIIRedactionPolicy.occupation,
],
redact_audio=True,
redact_audio_quality=aai.PIIRedactedAudioQuality.wav
)
transcriber = aai.Transcriber(config=config)
transcript = transcriber.transcribe(audio_url)
print(transcript.get_redacted_audio_url())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment