Skip to content

Commit

Permalink
Add missing import + Build for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed Oct 5, 2024
1 parent 57b5477 commit 05cf1b1
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 7 deletions.
19 changes: 14 additions & 5 deletions LlamaAssistant.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ import os, sys

sys.setrecursionlimit(5000) # required on Windows

# Get the package path
# Collect llama.cpp
package_path = get_package_paths('llama_cpp')[0]

# Collect data files
datas = collect_data_files('llama_cpp')

# Append the additional .dll or .so file
if os.name == 'nt': # Windows
for l in ["ggml", "llama", "llava"]:
dll_path = os.path.join(package_path, 'llama_cpp', 'lib', f'{l}.dll')
Expand All @@ -26,6 +22,19 @@ elif os.name == 'posix': # Linux
so_path = os.path.join(package_path, 'llama_cpp', 'lib', f'lib{l}.so')
datas.append((so_path, 'llama_cpp/lib'))

# Collect whisper.cpp
package_path = get_package_paths('whisper_cpp_python')[0]
datas += collect_data_files('whisper_cpp_python')
if os.name == 'nt': # Windows
dll_path = os.path.join(package_path, 'whisper_cpp_python', 'whisper.dll')
datas.append((dll_path, 'whisper_cpp_python'))
elif sys.platform == 'darwin': # Mac
dylib_path = os.path.join(package_path, 'whisper_cpp_python', 'libwhisper.dylib')
datas.append((dylib_path, 'whisper_cpp_python'))
elif os.name == 'posix': # Linux
so_path = os.path.join(package_path, 'whisper_cpp_python', 'libwhisper.so')
datas.append((so_path, 'whisper_cpp_python'))

datas += [
('llama_assistant/resources/*.onnx', 'llama_assistant/resources'),
('llama_assistant/resources/*.png', 'llama_assistant/resources'),
Expand Down
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,43 @@ https://github.com/user-attachments/assets/af2c544b-6d46-4c44-87d8-9a051ba213db

## Installation

**Install PortAudio:**

<details>
Install `PortAudio`_. This is required by the `PyAudio`_ library to stream
audio from your computer's microphone. PyAudio depends on PortAudio for cross-platform compatibility, and is installed differently depending on the
platform.

* For Mac OS X, you can use `Homebrew`_::

brew install portaudio

**Note**: if you encounter an error when running `pip install` that indicates
it can't find `portaudio.h`, try running `pip install` with the following
flags::

pip install --global-option='build_ext' \
--global-option='-I/usr/local/include' \
--global-option='-L/usr/local/lib' \
pyaudio

* For Debian / Ubuntu Linux::

apt-get install portaudio19-dev python3-all-dev

* Windows may work without having to install PortAudio explicitly (it will get
installed with PyAudio).

For more details, see the `PyAudio installation`_ page.


.. _PyAudio: https://people.csail.mit.edu/hubert/pyaudio/
.. _PortAudio: http://www.portaudio.com/
.. _PyAudio installation:
https://people.csail.mit.edu/hubert/pyaudio/#downloads
.. _Homebrew: http://brew.sh
</details>

**Install from PyPI:**

```bash
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyinstaller --noconfirm LlamaAssistant.spec
python3 -O -m PyInstaller --noconfirm LlamaAssistant.spec
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "llama-assistant"
version = "0.1.28"
version = "0.1.29"
authors = [
{name = "Viet-Anh Nguyen", email = "[email protected]"},
]
Expand Down Expand Up @@ -33,6 +33,7 @@ dependencies = [
"SpeechRecognition",
"huggingface_hub",
"openwakeword",
"whisper-cpp-python",
]
dynamic = []

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ llama-cpp-python
huggingface_hub==0.25.1
openwakeword==0.6.0
pyinstaller==6.10.0
whisper-cpp-python==0.2.0

0 comments on commit 05cf1b1

Please sign in to comment.