Skip to main content

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
  • pyaudio
  • ffmpeg for mp3 text-to-speech, brew install ffmpeg
brew install portaudio

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

afkode-0.4.4.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

afkode-0.4.4-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

Details for the file afkode-0.4.4.tar.gz.

File metadata

  • Download URL: afkode-0.4.4.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.9 CPython/3.8.17 Linux/5.15.0-1041-azure

File hashes

Hashes for afkode-0.4.4.tar.gz
Algorithm Hash digest
SHA256 e106efa3c9d8f6875f385985e0366ea9fe0ce265df15e701042d241cc29f641e
MD5 3bb7b51ad5dae9e62b53917fe7a40713
BLAKE2b-256 0e2fab2fcb44e5413206255bbc4c58cc9d63d290c69b1366fa7c8aa0b5330182

See more details on using hashes here.

File details

Details for the file afkode-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: afkode-0.4.4-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.17 Linux/5.15.0-1041-azure

File hashes

Hashes for afkode-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f8bb45e953f045ab868eaa31e0d219ad7791492b9260fa59e7634911c2dd4804
MD5 97c3a1cfc313a39118d0fff97a465574
BLAKE2b-256 85841b26238267429c29778e0ae3cbcae61c5cbd0b9b62b8743179379a780f61

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page