Last active
February 22, 2023 02:01
-
-
Save sheunaluko/3a2fdf28cac81a2ddd4678397c00f89d to your computer and use it in GitHub Desktop.
This is code for enabling voice interaction with the ChatGPT Research Preview. In order to use it (in Chrome or Safari which support the Web Speech API), simply paste the following code into the javascript console of the ChatGPT web application, accept "allow microphone", and then start talking!
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
/* helper function for loading an external script */ | |
function addScript(src) { | |
return new Promise((resolve, reject) => { | |
const s = document.createElement('script'); | |
s.setAttribute('src', src); | |
s.addEventListener('load', resolve); | |
s.addEventListener('error', reject); | |
document.body.appendChild(s); | |
}); | |
} | |
/* load the functionality from the tidyscripts library, which I maintain. Feel free to see the source code! */ | |
await addScript("https://tidyscripts.com/tidyscripts_web_umd.js") | |
/* | |
Initialize the voice modules. | |
If you only want the Speech Recognition without TTS, then use tsw.umd.chatgpt.start_speech_recognition_and_link_to_input() | |
*/ | |
await tsw.umd.chatgpt.initialize_voice_system_with_tts() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment