Generating a transcript from an audio file with the Google Cloud Speech-to-Text API
In this Python project the Google Cloud Speech-to-Text API is used to generate a transcript from an audio file.
This project includes the following files:
main_demo.py- main scripttranscript_generator.py- class for transcript generation
The folder 'audio_raw/' contains audio files that can be used to test the code (see 'Usage - Run demo'). This folder also contains the true transcripts of the provided audio files.
Python-Version: 3.7
All python packages needed to run the code are included in the 'requirements.txt' file. Read the section 'Usage - Run demo' on how to set up the python environment and on how to run the demo.
-
Download this repository.
-
Create a virtual environment with Python 3.
virtualenv -p python3 env1 -
Activate the environment.
source env1/bin/activate -
Install the required dependencies.
pip3 install -r requirements.txt
-
Set parameters in
main_demo.py(line 5 to 7). -
Set location for your Google credentials JSON-file in
main_demo.py(line 11).- How to get the Google credentials JSON-file: click here
-
Copy the audio files (.mp3 or .wav) into the folder 'audio_raw/'.
-
Run
main_demo.py. The generated transcripts are stored in the folder 'transcripts/' (folder will be created automatically).