Skip to content

Commit 2180ab4

Browse files
authored
Merge pull request #543 from ClinicianFOCUS/dev
v1.1.0: Mac Support & misc fixes
2 parents 2f6bd1c + 19173fb commit 2180ab4

84 files changed

Lines changed: 7265 additions & 828 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 130 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
# Create CUDA-enabled executable
3232
- name: Install CUDA-enabled llama_cpp
3333
run: |
34-
pip install --index-url https://abetlen.github.io/llama-cpp-python/whl/cu124 --extra-index-url https://pypi.org/simple llama-cpp-python==v0.2.90
34+
pip install --index-url https://abetlen.github.io/llama-cpp-python/whl/cu124 --extra-index-url https://pypi.org/simple llama-cpp-python==v0.3.8
3535
3636
- name: Instal CUDA drivers for NVIDIA install
3737
run: |
@@ -46,7 +46,7 @@ jobs:
4646
4747
- name: Run PyInstaller for NVIDIA
4848
run: |
49-
pyinstaller --runtime-hook=.\scripts\runtime_hooks\hook-runtime.py --additional-hooks-dir=.\scripts\hooks --hidden-import=en_core_web_md --add-data ".\scripts\NVIDIA_INSTALL.txt:install_state" --add-data ".\src\FreeScribe.client\whisper-assets:faster_whisper\assets" --add-data ".\src\FreeScribe.client\markdown:markdown" --add-data ".\src\FreeScribe.client\assets:assets" --add-data "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\nvidia:nvidia-drivers" --name freescribe-client-nvidia --icon=.\src\FreeScribe.client\assets\logo.ico --noconsole .\src\FreeScribe.client\client.py
49+
pyinstaller --runtime-hook=.\scripts\runtime_hooks\hook-runtime.py --additional-hooks-dir=.\scripts\hooks --hidden-import=en_core_web_md --hidden-import=en_core_sci_md --add-data ".\scripts\NVIDIA_INSTALL.txt:install_state" --add-data ".\src\FreeScribe.client\whisper-assets:faster_whisper\assets" --add-data ".\src\FreeScribe.client\markdown:markdown" --add-data ".\src\FreeScribe.client\assets:assets" --add-data "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\nvidia:nvidia-drivers" --name freescribe-client-nvidia --icon=.\src\FreeScribe.client\assets\logo.ico --noconsole .\src\FreeScribe.client\client.py
5050
5151
# Create CPU-only executable
5252
- name: Uninstall CUDA-enabled llama_cpp (if necessary) and install CPU-only llama_cpp
@@ -56,18 +56,136 @@ jobs:
5656
pip uninstall nvidia-cuda-nvrtc-cu12==12.4.127
5757
pip uninstall nvidia-cublas-cu12==12.4.5.8
5858
pip uninstall -y llama-cpp-python
59-
pip install --index-url https://abetlen.github.io/llama-cpp-python/whl/cpu --extra-index-url https://pypi.org/simple llama-cpp-python==v0.2.90
59+
pip install --index-url https://abetlen.github.io/llama-cpp-python/whl/cpu --extra-index-url https://pypi.org/simple llama-cpp-python==v0.3.8
6060
6161
- name: Run PyInstaller for CPU-only
6262
run: |
63-
pyinstaller --runtime-hook=.\scripts\runtime_hooks\hook-runtime.py --additional-hooks-dir=.\scripts\hooks --hidden-import=en_core_web_md --add-data ".\scripts\CPU_INSTALL.txt:install_state" --add-data ".\src\FreeScribe.client\whisper-assets:faster_whisper\assets" --add-data ".\src\FreeScribe.client\markdown:markdown" --add-data ".\src\FreeScribe.client\assets:assets" --name freescribe-client-cpu --icon=.\src\FreeScribe.client\assets\logo.ico --noconsole .\src\FreeScribe.client\client.py
63+
pyinstaller --runtime-hook=.\scripts\runtime_hooks\hook-runtime.py --additional-hooks-dir=.\scripts\hooks --hidden-import=en_core_web_md --hidden-import=en_core_sci_md --add-data ".\scripts\CPU_INSTALL.txt:install_state" --add-data ".\src\FreeScribe.client\whisper-assets:faster_whisper\assets" --add-data ".\src\FreeScribe.client\markdown:markdown" --add-data ".\src\FreeScribe.client\assets:assets" --name freescribe-client-cpu --icon=.\src\FreeScribe.client\assets\logo.ico --noconsole .\src\FreeScribe.client\client.py
6464
6565
- name: Set up NSIS
6666
uses: joncloud/makensis-action@1c9f4bf2ea0c771147db31a2f3a7f5d8705c0105
6767
with:
6868
script-file: .\scripts\install.nsi
6969
additional-plugin-paths: "./scripts/nsis-plugins"
7070

71+
- name: Rename Installer
72+
run: |
73+
mv dist/FreeScribeInstaller.exe dist/FreeScribeInstaller_windows.exe
74+
75+
- name: Upload Artifact
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: FreeScribeInstaller_windows.exe
79+
path: dist/FreeScribeInstaller_windows.exe
80+
81+
82+
build-macos-intel:
83+
runs-on: macos-13
84+
permissions:
85+
contents: write
86+
steps:
87+
- name: Checkout
88+
uses: actions/checkout@v4
89+
90+
- name: Install Python
91+
uses: actions/setup-python@v5
92+
with:
93+
python-version: "3.12"
94+
cache: "pip"
95+
cache-dependency-path: "**/client_requirements_mac.txt"
96+
97+
- name: Install PortAudio
98+
run: |
99+
brew install portaudio
100+
101+
- name: Install requirements
102+
run: |
103+
pip install -r client_requirements_mac.txt
104+
105+
- name: Install ffmpeg
106+
run: |
107+
brew install ffmpeg
108+
109+
- name: Build macOS app
110+
run: |
111+
./build-mac.sh
112+
113+
- name: Build PKG installer
114+
run: |
115+
./build-pkg.sh --arch x86_64
116+
env:
117+
GITHUB_REF: ${{ github.ref }}
118+
119+
- name: Upload Artifact
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: FreeScribeInstaller_x86_64.pkg
123+
path: dist/FreeScribeInstaller_x86_64.pkg
124+
125+
build-macos-arm:
126+
runs-on: macos-latest
127+
permissions:
128+
contents: write
129+
steps:
130+
- name: Checkout
131+
uses: actions/checkout@v4
132+
133+
- name: Install Python
134+
uses: actions/setup-python@v5
135+
with:
136+
python-version: "3.12"
137+
cache: "pip"
138+
cache-dependency-path: "**/client_requirements_mac.txt"
139+
140+
- name: Install PortAudio
141+
run: |
142+
brew install portaudio
143+
144+
- name: Install requirements
145+
run: |
146+
pip install -r client_requirements_mac.txt
147+
148+
- name: Install ffmpeg
149+
run: |
150+
brew install ffmpeg
151+
152+
- name: Build macOS app
153+
run: |
154+
./build-mac.sh
155+
156+
- name: Build PKG installer
157+
run: |
158+
./build-pkg.sh --arch arm64
159+
env:
160+
GITHUB_REF: ${{ github.ref }}
161+
162+
- name: Upload Artifact
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: FreeScribeInstaller_arm64.pkg
166+
path: dist/FreeScribeInstaller_arm64.pkg
167+
168+
create-release:
169+
runs-on: ubuntu-latest
170+
needs: [build-windows, build-macos-intel, build-macos-arm]
171+
permissions:
172+
contents: write
173+
steps:
174+
- name: Download Windows Installer
175+
uses: actions/download-artifact@v4
176+
with:
177+
name: FreeScribeInstaller_windows.exe
178+
179+
- name: Download Intel Installer
180+
uses: actions/download-artifact@v4
181+
with:
182+
name: FreeScribeInstaller_x86_64.pkg
183+
184+
- name: Download ARM Installer
185+
uses: actions/download-artifact@v4
186+
with:
187+
name: FreeScribeInstaller_arm64.pkg
188+
71189
- name: Check if alpha or RC release
72190
id: check_alpha
73191
run: |
@@ -78,29 +196,22 @@ jobs:
78196
}
79197
shell: pwsh
80198

81-
- name: Create release
82-
id: create_release
83-
uses: actions/create-release@v1
199+
- name: Upload Installer
200+
id: upload-installer
201+
uses: softprops/action-gh-release@v2
84202
env:
85203
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86204
with:
205+
name: Release ${{ github.ref_name }}
87206
tag_name: ${{ github.ref }}
88-
release_name: Release ${{ github.ref }}
89207
body: |
90208
## What's Changed
91209
${{ steps.changelog.outputs.CHANGELOG }}
92210
93211
For full changelog, see [the commits since last release](${{ github.server_url }}/${{ github.repository }}/compare/${{ steps.changelog.last_tag }}...${{ github.ref }})
94212
draft: false
95213
prerelease: ${{ steps.check_alpha.outputs.is_alpha == 'true' }}
96-
97-
- name: Upload Installer
98-
id: upload-installer
99-
uses: actions/upload-release-asset@v1
100-
env:
101-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
with:
103-
upload_url: ${{steps.create_release.outputs.upload_url}}
104-
asset_path: dist/FreeScribeInstaller.exe
105-
asset_name: FreeScribeInstaller_windows.exe
106-
asset_content_type: application/octet-stream
214+
files: |
215+
FreeScribeInstaller_x86_64.pkg
216+
FreeScribeInstaller_arm64.pkg
217+
FreeScribeInstaller_windows.exe

.gitignore

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
.cursorignore
2+
.flatpak-builder/
3+
.python-version
4+
build-dir/
5+
repo/
6+
7+
freescribe.log.*
8+
*.log
9+
110
.idea/
211
__version__
312

@@ -15,14 +24,18 @@ output
1524
client.spec
1625
.aider*
1726
.DS_Store
27+
install_state
1828

1929
realtime.wav
2030
src/FreeScribe.client/models
2131
freescribe-client.spec
2232
freescribe-client-cpu.spec
2333
freescribe-client-nvidia.spec
2434
scripts/FreeScribeInstaller.exe
25-
35+
launch.json
2636
_build
37+
/mac/scripts/preinstall
38+
39+
freescribe.log
2740

2841
freescribe.log

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# FreeScribe
2+
<p>
3+
<a href="https://github.com/ClinicianFOCUS/FreeScribe"><img src="https://img.shields.io/badge/python-3.10-blue" alt="FreeScribe"></a>
4+
</p>
25

36
## Introduction
47

build-linux.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
# Ensure the script exits if any command fails
4+
set -e
5+
6+
# Define the name of the executable and the main Python script
7+
EXECUTABLE_NAME="FreeScribe"
8+
MAIN_SCRIPT="src/FreeScribe.client/client.py"
9+
ICON_PATH="src/FreeScribe.client/assets/logo.ico"
10+
MODEL_URL="https://huggingface.co/lmstudio-community/gemma-2-2b-it-GGUF/resolve/main/gemma-2-2b-it-Q8_0.gguf?download=true"
11+
12+
# Run PyInstaller to create the standalone executable
13+
pyinstaller --additional-hooks-dir=./scripts/hooks \
14+
--add-data "./scripts/NVIDIA_INSTALL.txt:install_state" \
15+
--add-data "./src/FreeScribe.client/whisper-assets:faster_whisper/assets" \
16+
--add-data "./src/FreeScribe.client/markdown:markdown" \
17+
--add-data "./src/FreeScribe.client/assets:assets" \
18+
--add-data "/home/invain/.virtualenvs/freescribe/lib/python3.10/site-packages/nvidia:nvidia-drivers" \
19+
--hidden-import PIL._tkinter_finder \
20+
--hidden-import PIL.ImageTk \
21+
--name "$EXECUTABLE_NAME" \
22+
--icon="$ICON_PATH" \
23+
--noconsole \
24+
--noconfirm \
25+
"$MAIN_SCRIPT"
26+
27+
28+
# Print a message indicating that the build is complete
29+
echo "Build complete. Executable created: dist/FreeScribe/$EXECUTABLE_NAME"

build-mac.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
set -e
55

66
# Define the name of the executable and the main Python script
7-
EXECUTABLE_NAME="freescribe-client"
7+
EXECUTABLE_NAME="FreeScribe"
88
MAIN_SCRIPT="src/FreeScribe.client/client.py"
99
ICON_PATH="src/FreeScribe.client/assets/logo.ico"
1010

1111
# Run PyInstaller to create the standalone executable
12-
pyinstaller --add-data "./src/FreeScribe.client/whisper-assets:whisper/assets" --add-data "./src/FreeScribe.client/markdown:markdown" --add-data "./src/FreeScribe.client/assets:assets" --name "$EXECUTABLE_NAME" --icon="$ICON_PATH" "$MAIN_SCRIPT" --windowed
12+
pyinstaller client-mac.spec --noconfirm
1313

1414
# Print a message indicating that the build is complete
1515
echo "Build complete. Executable created: $DIST_PATH/$EXECUTABLE_NAME.app"

build-pkg.sh

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,42 @@
33
# Ensure the script exits if any command fails
44
set -e
55

6+
usage() {
7+
echo "Usage: $0 --arch <arm64|x86_64>"
8+
exit 1
9+
}
10+
11+
# Parse arguments
12+
while [[ "$#" -gt 0 ]]; do
13+
case $1 in
14+
--arch)
15+
ARCH="$2"
16+
shift
17+
;;
18+
*)
19+
usage
20+
;;
21+
esac
22+
shift
23+
done
24+
25+
# Check if arch argument is provided
26+
if [[ -z "$ARCH" ]]; then
27+
usage
28+
fi
29+
30+
case $ARCH in
31+
arm64)
32+
echo "Building for Apple Silicon-based Macs"
33+
;;
34+
x86_64)
35+
echo "Building for Intel-based Macs"
36+
;;
37+
*)
38+
usage
39+
;;
40+
esac
41+
642
DIR_NAME="dist/client"
743
IDENTIFIER="com.clinicianfocus.freescribe"
844

@@ -13,15 +49,38 @@ mkdir -p $DIR_NAME
1349
echo "Creating directory dist/installer"
1450
mkdir -p dist/installer
1551

52+
echo "Copying Preinstall script"
53+
cp mac/scripts/preinstall_"$ARCH" mac/scripts/preinstall
54+
1655
echo "Moving app to $DIR_NAME"
17-
mv dist/freescribe-client.app $DIR_NAME
56+
mv dist/FreeScribe.app $DIR_NAME
57+
58+
# Create the __version__ file
59+
VERSION_FILE="$DIR_NAME/FreeScribe.app/Contents/Frameworks/__version__"
60+
echo "Creating __version__ file at $VERSION_FILE"
61+
tag="${GITHUB_REF#refs/tags/}"
62+
echo "$tag" > "$VERSION_FILE"
63+
64+
# Verify the __version__ file exists
65+
if [[ ! -f "$VERSION_FILE" ]]; then
66+
echo "Error: __version__ file was not created successfully."
67+
exit 1
68+
fi
1869

1970
# Build pkg installer for macOS using the pkgbuild command
20-
pkgbuild --root $DIR_NAME --identifier $IDENTIFIER --scripts ./mac/scripts/ --version 1.0 --install-location /Applications ./dist/installer/installer.pkg
71+
pkgbuild --root $DIR_NAME \
72+
--identifier $IDENTIFIER \
73+
--scripts ./mac/scripts/ \
74+
--version 1.0 \
75+
--install-location /Applications \
76+
./dist/installer/installer.pkg
2177

2278
echo "Build complete. Installer created: dist/installer.pkg"
2379

2480
# Build the final installer package using the productbuild command
25-
productbuild --distribution ./mac/distribution.xml --package-path ./dist/installer/ --resources ./mac/resources/ ./dist/FreeScribeInstaller.pkg
81+
productbuild --distribution ./mac/distribution.xml \
82+
--package-path ./dist/installer/ \
83+
--resources ./mac/resources/ \
84+
./dist/FreeScribeInstaller_"$ARCH".pkg
2685

27-
echo "Build complete. Final installer package created: dist/FreeScribeInstaller.pkg"
86+
echo "Build complete. Final installer package created: dist/FreeScribeInstaller_"$ARCH".pkg"

0 commit comments

Comments
 (0)