Get an audio response from ChatGPT
Project description
PyAudioAI Python Library
The Python library combines the OpenAI ChatGPT API with audio input and output. With this, questions can be recorded as audio, sent to ChatGPT and the answer from ChatGPT can be output as audio again. For the audio output, gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate's text-to-speech API is used.
Installation
You don't need this source code unless you want to modify the package. If you just want to use the package, just run:
pip install pyaudioai
Install from source with:
python setup.py install
Usage
Portaudio needs to be configured to have access to your computers microphone.
Linux:
sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
Mac OS X:
brew install portaudio
Windows:
pip install pipwin
pipwin install pyaudio
The OpenAI library needs to be configured with your account's secret key OPENAI_API_KEY which is available on the website.
Example:
import os
import pyaudioai
audio_file = "question.wav" # question can be saved
question_audio = pyaudioai.RecordQuestion(5, audio_file)
question_audio.record()
response_class = pyaudioai.OpenAiResponse("<OPENAI_API_KEY>")
response_class.get_audio_response(audio_file)
question_audio.delete_file() # delete question audio if required
Developer Documentation
The documentation of the source code for contributors can be found here.
Project details
Release history Release notifications | RSS feed
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 pyaudioai-0.0.2.tar.gz
.
File metadata
- Download URL: pyaudioai-0.0.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc5c0986c1b8c6f464b70e6e8c446478c8252d26e0a117b591b071df374f0334 |
|
MD5 | df7fee3cd4b5e7005b6da7c697de89d6 |
|
BLAKE2b-256 | de283f7040ca335cb494ccda011108b4a932ea3b57832cd0762f5eb1e4fa44c6 |
File details
Details for the file pyaudioai-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pyaudioai-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62aedb753aa16e0d93c8d6355e17c8c35af82a32e9b38bbc012d3872bbd8b959 |
|
MD5 | 6c895dd6759da6365b9ff69e910615ee |
|
BLAKE2b-256 | f3276368a271b94b4d9c7ec76a52ec6b8f392f7fc2ff88e905717d62ad59c140 |