Last active
October 12, 2023 18:08
-
-
Save JamoCA/c7cdeaf9842c6233fe8e55b0c37642d5 to your computer and use it in GitHub Desktop.
Basic ColdFusion example to post an audio file to Deepgram's "listen" API to transcribe audio files. #cfml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
2023-10-12 Basic ColdFusion example to post an audio file to Deepgram's "listen" API to transcribe audio files | |
Gist: https://gist.github.com/JamoCA/c7cdeaf9842c6233fe8e55b0c37642d5 | |
Adobe Community Post: https://community.adobe.com/t5/coldfusion-discussions/help-converting-curl-to-cfhttp/m-p/14152562 | |
Deepgram documentation: https://developers.deepgram.com/docs/transcribing-pre-recorded-audio | |
My Twitter: https://twitter.com/gamesover | |
---> | |
<cfscript> | |
myApiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; | |
myFilePath = "c:\myimage.mp3"; | |
fileData = filereadbinary(myFilePath); | |
cfhttp(method="post", url="https://api.deepgram.com/v1/listen?model=nova-2-ea&smart_format=true") { | |
cfhttpparam(type="header", name="Authorization", value="Token #myApikey#"); | |
cfhttpparam(type="header", name="Accept", value="application/json"); | |
cfhttpparam(type="header", name="Content-Type", value="#fileGetMimeType(myFilePath)#"); | |
cfhttpparam(type="body", value="#fileData#"); | |
} | |
cf_dump(var=cfhttp); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment