A voice interface for OpenAI's ChatGPT
Project description
SpeechGPT
A voice interface for OpenAI's ChatGPT 🎙
Credit to @terry3041 for pyChatGPT ❤️
Features
This package detects microphone input and coverts it to text using Google's Speech Recognition API. It then opens ChatGPT and inputs the recognized text using selenium.
It can be used with a wake word, and it can also use text to speech to repeat ChatGPT's answer to the query. These arguements are specified in the creation of the class (see Getting Started)
Getting Started
Installation
pip3 install speechgpt
or
git clone https://github.com/Jdka1/SpeechGPT
Then navigate to SpeechGPT/speechgpt/
and place the files in the same directory as your main.py
file.
It is not uncommon that there are errors when installing pyaudio. If you are on macOS you may have to use homebrew to install portaudio
.
Usage
Obtaining session_token
Follow these steps in @terry3041's README.md
Importing as a module
from speechgpt import SpeechGPT
session_token = "<__Secure-next-auth.session-token cookie from https://chat.openai.com/chat>"
bot = SpeechGPT(session_token=session_token) # Initializing the bot
bot.listen() # The bot will start listening and respond to whatever it is prompted with using ChatGPT
If the bot is initialized with a wake_word
value then it will wait until it hears that phrase when bot.listen()
is called, and then it will start listening.
If the bot is initialized with voice_on = True
as an arguement, then it will use text to speech to play back ChatGPT's response.
# How to initialize SpeechGPT with wake_word and voice_on
bot = SpeechGPT(session_token=session_token,
wake_word="wake up",
voice_on=True)
.listen()
only runs one cycle, so it needs to be put in a loop for it to answer more than one prompt
while True:
bot.listen()
If the bot hears "quit" at any stage after .listen()
is called then it will quit.
Disclaimer
This package is not affiliated with OpenAI in any way. Use at your own risk. I am not responsible for any damage or harm caused by this project. Please read OpenAI's Terms of Service before using this module.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file speechgpt-0.1.2.tar.gz
.
File metadata
- Download URL: speechgpt-0.1.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37c08117b3c0c3cfac8fd52e45371174861c1f0b5e7d5103b38f2952b98deb7d |
|
MD5 | fec0c9845b13b64a846875a246fbc70c |
|
BLAKE2b-256 | db7360a733a46b907bdbde056c6ba77efd6de3abac1cb7f83db3df20bd4fc3e2 |
File details
Details for the file speechgpt-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: speechgpt-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f28d10ad62aa47cda5e9f651e111086616901404db7e73027133d34e0211610 |
|
MD5 | b292b6eee174e9fb6b4562d0c4b8012d |
|
BLAKE2b-256 | 9890a10e0add55dc86bf37a888ab2337eee42ffded800e2ad7c608d2d8614bb6 |