From 5e7432cf52ad286324802e0ca632053ac9304481 Mon Sep 17 00:00:00 2001 From: nikkie Date: Sat, 30 Mar 2024 14:16:34 +0000 Subject: [PATCH 1/3] [chore] Add extra for openai-whisper --- setup.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.cfg b/setup.cfg index 69c937c4..d2fa6c02 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,5 +4,8 @@ universal=1 [options.extras_require] +whisper-local = + openai-whisper + soundfile whisper-api = openai From f294669e242c7910f427b48506dbefa1b7fbd75e Mon Sep 17 00:00:00 2001 From: nikkie Date: Sat, 30 Mar 2024 14:17:06 +0000 Subject: [PATCH 2/3] [chore] Refactor using extras --- .github/workflows/unittests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index e12d6609..01ede18f 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -31,9 +31,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install 'pocketsphinx<5' - python -m pip install openai-whisper soundfile - python -m pip install openai - python -m pip install . + python -m pip install .[whisper-local,whisper-api] - name: Test with unittest run: | python -m doctest speech_recognition/recognizers/google.py -v From 863b10aae82f9a591a3f6291cc551743e3e14880 Mon Sep 17 00:00:00 2001 From: nikkie Date: Sat, 30 Mar 2024 14:24:39 +0000 Subject: [PATCH 3/3] [docs] Install whisper dependencies by specifying extra --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index d86ba5bf..50cae061 100644 --- a/README.rst +++ b/README.rst @@ -169,7 +169,7 @@ Whisper (for Whisper users) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Whisper is **required if and only if you want to use whisper** (``recognizer_instance.recognize_whisper``). -You can install it with ``python3 -m pip install openai-whisper soundfile``. +You can install it with ``python3 -m pip install SpeechRecognition[whisper-local]``. Whisper API (for Whisper API users) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -178,7 +178,7 @@ The library `openai `__ is **required if and o If not installed, everything in the library will still work, except calling ``recognizer_instance.recognize_whisper_api`` will raise an ``RequestError``. -You can install it with ``python3 -m pip install openai``. +You can install it with ``python3 -m pip install SpeechRecognition[whisper-api]``. Troubleshooting ---------------