Build With the Official Deepgram SDKs
in Product News
July 22, 2022We love empowering our developer communities to take full advantage of voice in their applications. So, we're announcing two new official SDKs for Node.js and Python. Both of these SDKs make it easier than ever to add automated speech-to-text recognition to your applications.
How Easy Is It?
To get started, make sure you have a Deepgram account by signing up at https://console.deepgram.com/signup. After signing up, log in and get an API key. Then, in your terminal, run the appropriate command below to install the SDK.
Node.js
npm install @deepgram/sdk
Python
pip install deepgram-sdk
Once the SDK has been installed, the following snippets will allow you to transcribe a prerecorded audio file. Be sure to replace YOUR_DEEPGRAM_API_KEY
with the API key, you created earlier.
Node.js
const { Deepgram } = require("@deepgram/sdk");
const deepgramApiKey = "YOUR_DEEPGRAM_API_KEY";
function main() {
return new Promise((resolve, reject) => {
(async () => {
try {
const deepgram = new Deepgram(deepgramApiKey);
const transcription = await newDeepgram.transcription.preRecorded(
{
url: "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav",
},
{
punctuate: true,
}
);
console.dir(transcription, { depth: null });
resolve();
} catch (err) {
console.log(`Err: ${err}`);
reject(err);
}
})();
});
}
main();
Python
from deepgram import Deepgramimport asyncio, json
DEEPGRAM_API_KEY = 'YOUR_API_KEY'
async def main():
# Initializes the Deepgram SDK
dg_client = Deepgram(DEEPGRAM_API_KEY)
source = {'url': 'https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav'}
response = await dg_client.transcription.prerecorded(source)
print(json.dumps(response, indent=4))
asyncio.run(main())
Contributions Welcome
Our SDKs are still in their infancy, but we're building them in public. We welcome all issues and pull requests to our Node.js and Python repositories. Of course, we'd also love to hear what you're building, so tweet at @DeepgramDevs and let us know!
If you have any feedback about this post, or anything else around Deepgram, we'd love to hear from you. Please let us know in our GitHub discussions .
More with these tags:
Share your feedback
Was this article useful or interesting to you?
Thank you!
We appreciate your response.