Giter VIP home page Giter VIP logo

speechgpt's Introduction

SpeechGPT

PyPi License: MIT

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.

speechgpt's People

Contributors

jdka1 avatar rajeshias avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.