Skip to content

Commit

Permalink
Update package data paths in setup.py and remove redundant entries fr…
Browse files Browse the repository at this point in the history
…om pyproject.toml; add input validation in transcribe method
  • Loading branch information
royshil committed Nov 14, 2024
1 parent e2f2426 commit e032efc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ test = [

[tool.setuptools]
packages = ["simpler_whisper"]
include-package-data = true

[tool.setuptools.package-data]
simpler_whisper = ["*.dll", "*.pyd", "*.so", "*.metal", "*.dylib"]

[tool.pytest]
testpaths = ["tests"]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def build_extension(self, ext):
"numpy",
],
package_data={
"simpler_whisper": ["*.dll", "*.pyd", "*.so", "*.metal", "*.bin", "*.dylib"],
"simpler_whisper": ["./*.dll", "./*.pyd", "./*.so", "./*.metal", "./*.bin", "./*.dylib"],
},
include_package_data=True,
)
6 changes: 6 additions & 0 deletions src/whisper_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ class AsyncWhisperModel
*/
size_t transcribe(py::array_t<float> audio)
{
// Check if input is empty
if (audio.is_none() || audio.size() == 0)
{
return 0;
}

return this->queueAudio(audio);
}

Expand Down

0 comments on commit e032efc

Please sign in to comment.