This is a simple app that demonstrates how to use the Google Speech-to-Text API in a Node.js and React application.
-
Node.js (tested with version 14.x)
-
React (tested with version 16.x)
-
Google Cloud Platform Service Account Key with Speech-to-text api permissions
Follow this tutorial to create credentials and learn how to use the Google-Speech-To-Text API
- Clone this repository:
git clone https://github.com/untilhamza/Real-time-transcription-with-Google-speech-to-text-API.git
- Navigate to the react-app project directory:
cd stt-client
- Install dependencies:
yarn
- Start the development server:
yarn start
- Navigate back to the parent directory :
cd..
The app will now be running at http://localhost:3000.
- Make sure to get a Google cloud Service Account Key as shown in this tutorial
- Download the generated Service Account key json file save it to the server folder as
speech-to-text-key.json
.This file name is already added to the .gitignore file but make sure not to push to github or any public repositories
- Open the server folder and add this line in
index.js
file to add google credentials to our node js backend.
process.env.GOOGLE_APPLICATION_CREDENTIALS = "./speech-to-text-key.json"; //TODO: set this to the path for your Service account key JSON file
- Navigate to the server project directory:
cd server
- Install dependencies:
yarn
- Start the development server:
yarn run dev
- Start the development server:
npm start
The backend listens at http://localhost:8081.
To use the app, simply click the "Start Recording" button and speak into your microphone. The transcription will appear on the screen as you speak, updating in real-time. When you're finished, click the "Stop Recording" button to see the final transcription.
This app was built by Hamza using the Google Speech-to-Text API.
This project is licensed under the MIT License. See the LICENSE file for more details.