Personal voice command interface for iPhone on pythonista powered by Whisper and ChatGPT.
Project description
AFKode - Speak it, Save it, AFKode it!
AFKode allows users to interact with AI and file system using only voice, allowing you to work away from keyboard. Works on iPhone with pythonista, or on MacOS. Powered by Whisper and ChatGPT.
This project was inspired by long walks on the beach while ruminating and organizing ones thoughts.
Users of this program should be comfortable using pythonista/python.
You are required to BYO OpenAI secret key in variable OPENAI_KEY
using environment variables or within afkcode/secrets.py
.
Key features:
- Detection of start/stop dictation for transcription
- Uses ChatGPT create smart file naming for your notes
Interfaces:
- At home: Supports MacOS with base speakers/microphone or AirPods. May not work with other bluetooth headsets like Bose headphones.
- Out and about: Supports Pythonista iOS with base speakers/microphones, or plugged in lightning wired heaphones. Bluetooth headsets like AirPods and Bose headphones currently not working.
Contents
Instructions for users
The following are the quick start instructions for using the project as an end-user.
Follow the Instructions for developers to set up the virtual environment and dependency management.
Installation
MacOS requirements:
- Python 3.8
- ffmpeg for mp3 text-to-speech,
brew install ffmpeg
Note: Instructions marked with %% are not functioning and are for demo purposes only.
Install the project using pip %%:
pip install afkode
To replicate the data transformations and model results, run the following commands from the project root.
These should be run from the poetry shell
, or conda
environment, or with the poetry run
prefix.
python -m afkode.run
Usage documentation
The user guides can be found on github pages.
This includes overview of features, discussion of afkode
framework, and API reference.
Bug reports
Please raise an issue with bug
label and I will look into it!
Instructions for developers
The following are the setup instructions for developers looking to improve this project. For information on current contributors and guidelines see the contributors section. Follow each step here and ensure tests are working.
Poetry
Poetry handles virtual environment management, dev and optional extra libraries, library development, builds and publishing.
Check the poetry website for the latest instructions on how to install poetry. You can use the following command on OS/linux to install poetry 1.1.9 used in this project.
curl -sSL https://install.python-poetry.org | python - --version 1.1.9
It is recommended to set virtual environment creation to within project using the following command.
This adds a .venv
directory to project to handle cache and virtual environment.
poetry config virtualenvs.in-project true
You can set up the virtual environment in the repo using the following command.
Make sure that any other virtual environments (i.e. conda deactivate
) are deactivated before running.
poetry install
Troubleshooting: You may need to point poetry to the correct python interpreter using the following command.
In another terminal and in conda, run which python
.
poetry env use /path/to/python3
When the environment is correctly installed, you can enter the virtual environment using poetry shell
. Library can be built using poetry build
.
Testing with Nox
Nox is a command-line tool that automates testing in multiple Python environments, similar to tox, Makefiles or scripts. Unlike tox, Nox uses a standard Python file for configuration.
Here it is used for code quality, testing, and generating documentation.
The following command can be used to run mypy, lint, and tests. It is recommended to run these before pushing code, as this is run with Github Actions. Some checks such as black are run more frequently with pre-commit.
poetry run nox
Local Sphinx documentation can be generated with the following command. Documentation publishing using Github Actions to Github pages is enabled by default.
poetry run nox -s docs
Other available commands include:
poetry run nox -rs coverage
Code formatting with Pre-commit
Pre-commit is a framework for managing and maintaining multi-language pre-commit hooks.
It intercepts the git commit
command to run checks of staged code before the commit is finalized.
The checks are specified in .pre-commit-config.yaml
.
Checks in use are quick, pragmatic, and apply automatic formatting checks.
If checks fail, it is usually only a matter of re-staging the files (git add
) and attempting to commit again.
The aim is to provide a lightweight way to keep some code standards automatically in line with standards. This does not replace the need to run nox tests, although pre-commits will satisfy some of the nox test checks.
On first time use of the repository, pre-commit will need to be installed locally.
You will need to be in the poetry shell
or conda
environment.
Run the following command to perform a first time install.
pre-commit install
This will cache several code assets used in the checks.
When you have new code to commit, pre-commit will kick in and check the code. Alternatively, you can run the following command to run for all files in repo.
pre-commit run --all-files
Contributors
- Nick Jenkins - Data Scientist, API & Web dev, Team lead, Writer
See CONTRIBUTING.md in Github repo for specific instructions on contributing to project.
Usage rights governed by LICENSE in Github repo or page footer.
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 afkode-0.4.2.tar.gz
.
File metadata
- Download URL: afkode-0.4.2.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.9 CPython/3.8.8 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8c5b1d35a3b86a6558ecbf373148669ef37713ab04fb38159cba0df33377acd |
|
MD5 | 1c65a1d9545a6b80dd712e1ebdddb72c |
|
BLAKE2b-256 | 3a94f2c52157a6f7aa30e374dcdf0cd7afb3eb088aacd3eee8b2133c8731c3c7 |
File details
Details for the file afkode-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: afkode-0.4.2-py3-none-any.whl
- Upload date:
- Size: 43.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.9 CPython/3.8.8 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dee085c1ebfd48ed70e46d38d247337f67ca78f23dcbbf60581bc2cd860a8fa |
|
MD5 | e2e67c822bf0a4be49345ebd2837e0c7 |
|
BLAKE2b-256 | 4572ee79c4872edd2b7fc1f8657e4949cd456c1c958a103f5b0a5a9b8fad14db |