about summary refs log tree commit diff
path: root/pkgs/tools/audio/wyoming
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2023-06-09 18:02:42 +0200
committerMartin Weinelt <hexa@darmstadt.ccc.de>2023-06-12 18:44:43 +0200
commitdd8a4a6eb8cafc5abee60a4cf4bdc1b8cd565045 (patch)
tree727d976f4335e5120aeaf9f29ef18fe0368a6f3e /pkgs/tools/audio/wyoming
parent3e235f99b9ce612aae9abb89cdd2920d6d56f021 (diff)
wyoming-faster-whisper: init at 0.0.3
Wyoming Server for Faster Whisper, a reimplementation of OpenAI's
Whisper model using CTranslate2.
Diffstat (limited to 'pkgs/tools/audio/wyoming')
-rw-r--r--pkgs/tools/audio/wyoming/faster-whisper-entrypoint.patch29
-rw-r--r--pkgs/tools/audio/wyoming/faster-whisper.nix40
2 files changed, 69 insertions, 0 deletions
diff --git a/pkgs/tools/audio/wyoming/faster-whisper-entrypoint.patch b/pkgs/tools/audio/wyoming/faster-whisper-entrypoint.patch
new file mode 100644
index 0000000000000..1af62cb1fe224
--- /dev/null
+++ b/pkgs/tools/audio/wyoming/faster-whisper-entrypoint.patch
@@ -0,0 +1,29 @@
+diff --git a/setup.py b/setup.py
+index 1c0b2d2..bbff1d1 100644
+--- a/setup.py
++++ b/setup.py
+@@ -35,4 +35,9 @@ setup(
+         "Programming Language :: Python :: 3.10",
+     ],
+     keywords="rhasspy wyoming whisper",
++    entry_points={
++        'console_scripts': [
++            'wyoming-faster-whisper = wyoming_faster_whisper:__main__.run'
++        ]
++    }
+ )
+diff --git a/wyoming_faster_whisper/__main__.py b/wyoming_faster_whisper/__main__.py
+index 5557cc5..bb9d69f 100755
+--- a/wyoming_faster_whisper/__main__.py
++++ b/wyoming_faster_whisper/__main__.py
+@@ -131,5 +131,9 @@ async def main() -> None:
+ 
+ # -----------------------------------------------------------------------------
+ 
+-if __name__ == "__main__":
++def run():
+     asyncio.run(main())
++
++
++if __name__ == "__main__":
++    run()
diff --git a/pkgs/tools/audio/wyoming/faster-whisper.nix b/pkgs/tools/audio/wyoming/faster-whisper.nix
new file mode 100644
index 0000000000000..7479473223452
--- /dev/null
+++ b/pkgs/tools/audio/wyoming/faster-whisper.nix
@@ -0,0 +1,40 @@
+{ lib
+, python3
+, fetchPypi
+}:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "wyoming-faster-whisper";
+  version = "0.0.3";
+  format = "setuptools";
+
+  src = fetchPypi {
+    pname = "wyoming_faster_whisper";
+    inherit version;
+    hash = "sha256-uqepa70lprzV3DJK2wrNAAyZkMMJ5S86RKK716zxYU4=";
+  };
+
+  patches = [
+    ./faster-whisper-entrypoint.patch
+  ];
+
+  propagatedBuildInputs = with python3.pkgs; [
+    ctranslate2
+    tokenizers
+    wyoming
+  ];
+
+  pythonImportsCheck = [
+    "wyoming_faster_whisper"
+  ];
+
+  # no tests
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Wyoming Server for Faster Whisper";
+    homepage = "https://pypi.org/project/wyoming-faster-whisper/";
+    license = licenses.mit;
+    maintainers = with maintainers; [ hexa ];
+  };
+}