Testing transcribe

This commit is contained in:
2024-08-13 12:32:02 +02:00
parent 215a36f91e
commit dbcb8cce27
2 changed files with 29 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
# Start by making sure the `assemblyai` package is installed.
# If not, you can install it by running the following command:
# pip install -U assemblyai
#
# Note: Some macOS users may need to use `pip3` instead of `pip`.
import assemblyai as aai
# Replace with your API key
aai.settings.api_key = "aa9962f0088a449a9c4ab2361e96cc08"
# URL of the file to transcribe
FILE_URL = "https://github.com/AssemblyAI-Community/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3"
# You can also transcribe a local file by passing in a file path
# FILE_URL = './path/to/file.mp3'
config = aai.TranscriptionConfig(speaker_labels=True)
transcriber = aai.Transcriber()
transcript = transcriber.transcribe(
FILE_URL,
config=config
)
for utterance in transcript.utterances:
print(f"Speaker {utterance.speaker}: {utterance.text}")
+2 -1
View File
@@ -13,4 +13,5 @@ tiktoken
PyNaCl
flask
waitress
clickupython
clickupython
assemblyai