Skip to content

Commit

Permalink
Add pip installation (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
chidiwilliams authored Oct 28, 2023
1 parent a3b5489 commit eedc2ab
Show file tree
Hide file tree
Showing 30 changed files with 67 additions and 267 deletions.
12 changes: 7 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 23.7.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: black
language_version: python3.10
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]

- id: ruff-format
6 changes: 2 additions & 4 deletions Buzz.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ datas += copy_metadata('tokenizers')
datas += collect_data_files('transformers', include_py_files=True)

datas += collect_data_files('whisper')
datas += [('whisper.dll' if platform.system() == 'Windows' else 'libwhisper.*', '.')]
datas += [(shutil.which('whisper_cpp') if platform.system() == 'Windows' else 'whisper_cpp', '.')]
datas += [('assets/*', 'assets')]
datas += [(file[1], os.path.dirname(file[1])) for file in Tree('./locale', prefix='locale', excludes=['*.po'])]
datas += [(file[1], os.path.dirname(file[1])) for file in
Tree('./locale', prefix='locale', excludes=['*.po'])]
datas += [(shutil.which('ffmpeg'), '.')]

block_cipher = None
Expand Down
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ endif

clean:
rm -f $(LIBWHISPER)
rm -f whisper_cpp
rm -f buzz/whisper_cpp.py
rm -rf dist/* || true

Expand Down Expand Up @@ -66,16 +65,14 @@ else
endif
endif

$(LIBWHISPER) whisper_cpp:
buzz/$(LIBWHISPER):
cmake -S whisper.cpp -B whisper.cpp/build/ $(CMAKE_FLAGS)
cmake --build whisper.cpp/build --verbose
cp whisper.cpp/build/bin/Debug/$(LIBWHISPER) . || true
cp whisper.cpp/build/bin/Debug/main whisper_cpp || true
cp whisper.cpp/build/$(LIBWHISPER) . || true
cp whisper.cpp/build/bin/main whisper_cpp || true
cp whisper.cpp/build/bin/Debug/$(LIBWHISPER) buzz || true
cp whisper.cpp/build/$(LIBWHISPER) buzz || true

buzz/whisper_cpp.py: $(LIBWHISPER)
ctypesgen ./whisper.cpp/whisper.h -l$(LIBWHISPER) -o buzz/whisper_cpp.py
buzz/whisper_cpp.py: buzz/$(LIBWHISPER)
cd buzz && ctypesgen ../whisper.cpp/whisper.h -lwhisper -o whisper_cpp.py

# Prints all the Mac developer identities used for code signing
print_identities_mac:
Expand All @@ -89,7 +86,7 @@ dmg_mac:
--window-pos 200 120 \
--window-size 600 300 \
--icon-size 100 \
--icon "./assets/buzz.icns" 175 120 \
--icon "Buzz.app" 175 120 \
--hide-extension "Buzz.app" \
--app-drop-link 425 120 \
--codesign "$$BUZZ_CODESIGN_IDENTITY" \
Expand All @@ -108,7 +105,6 @@ zip_mac:

codesign_all_mac: dist/Buzz.app
codesign --force --options=runtime --sign "$$BUZZ_CODESIGN_IDENTITY" --timestamp dist/Buzz.app/Contents/Resources/ffmpeg
codesign --force --options=runtime --sign "$$BUZZ_CODESIGN_IDENTITY" --timestamp dist/Buzz.app/Contents/Resources/whisper_cpp
for i in $$(find dist/Buzz.app/Contents/Resources/torch/bin -name "*" -type f); \
do \
codesign --force --options=runtime --sign "$$BUZZ_CODESIGN_IDENTITY" --timestamp "$$i"; \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ OpenAI's [Whisper](https://github.com/openai/whisper).
<a href="https://apps.apple.com/us/app/buzz-captions/id6446018936?mt=12&amp;itsct=apps_box_badge&amp;itscg=30200"><img src="https://tools.applemediaservices.com/api/badges/download-on-the-mac-app-store/black/en-us?size=250x83&amp;releaseDate=1679529600" alt="Download on the Mac App Store" /></a>
</blockquote>

![Buzz](./assets/buzz-banner.jpg)
![Buzz](./buzz/assets/buzz-banner.jpg)

## Installation

Expand Down
4 changes: 2 additions & 2 deletions buzz/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

def get_asset_path(path: str):
if getattr(sys, "frozen", False):
return os.path.join(os.path.dirname(sys.executable), path)
return os.path.join(os.path.dirname(__file__), "..", path)
return os.path.join(os.path.dirname(sys.executable), "buzz", path)
return os.path.join(os.path.dirname(__file__), path)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added buzz/assets/buzz.icns
Binary file not shown.
Binary file added buzz/assets/buzz.ico
Binary file not shown.
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion buzz/buzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import sys
from typing import TextIO

from PyQt6.QtCore import QLocale
from appdirs import user_log_dir

# Check for segfaults if not running in frozen mode
Expand Down
Loading

0 comments on commit eedc2ab

Please sign in to comment.