mirror of
https://github.com/chidiwilliams/buzz.git
synced 2026-03-14 14:45:46 +01:00
Add ARM build
This commit is contained in:
parent
f0587cc7f9
commit
bc7309154a
4 changed files with 29 additions and 18 deletions
32
buzz/gui.py
32
buzz/gui.py
|
|
@ -4,7 +4,7 @@ import json
|
|||
import logging
|
||||
import os
|
||||
import platform
|
||||
import random
|
||||
import subprocess
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from enum import auto
|
||||
|
|
@ -30,6 +30,7 @@ from whisper import tokenizer
|
|||
from buzz.cache import TasksCache
|
||||
from .__version__ import VERSION
|
||||
from .model_loader import ModelLoader, WhisperModelSize, ModelType, TranscriptionModel
|
||||
from .path import resolve_path
|
||||
from .recording import RecordingAmplitudeListener
|
||||
from .transcriber import (SUPPORTED_OUTPUT_FORMATS, FileTranscriptionOptions, OutputFormat,
|
||||
Task,
|
||||
|
|
@ -39,18 +40,11 @@ from .transcriber import (SUPPORTED_OUTPUT_FORMATS, FileTranscriptionOptions, Ou
|
|||
|
||||
APP_NAME = 'Buzz'
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
if 'LANG' not in os.environ:
|
||||
language = str(QLocale().uiLanguages()[0]).replace("-", "_")
|
||||
os.environ['LANG'] = language
|
||||
|
||||
locale_dir = get_asset_path('locale')
|
||||
locale_dir = resolve_path('locale')
|
||||
gettext.bindtextdomain('buzz', locale_dir)
|
||||
|
||||
translate = gettext.translation(APP_NAME, locale_dir, fallback=True)
|
||||
|
|
@ -678,13 +672,13 @@ class RecordingTranscriberWidget(QWidget):
|
|||
return super().closeEvent(event)
|
||||
|
||||
|
||||
BUZZ_ICON_PATH = get_asset_path('assets/buzz.ico')
|
||||
BUZZ_LARGE_ICON_PATH = get_asset_path('assets/buzz-icon-1024.png')
|
||||
RECORD_ICON_PATH = get_asset_path('assets/mic_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
EXPAND_ICON_PATH = get_asset_path('assets/open_in_full_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
ADD_ICON_PATH = get_asset_path('assets/add_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
TRASH_ICON_PATH = get_asset_path('assets/delete_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
CANCEL_ICON_PATH = get_asset_path('assets/cancel_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
BUZZ_ICON_PATH = resolve_path('assets/buzz.ico')
|
||||
BUZZ_LARGE_ICON_PATH = resolve_path('assets/buzz-icon-1024.png')
|
||||
RECORD_ICON_PATH = resolve_path('assets/mic_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
EXPAND_ICON_PATH = resolve_path('assets/open_in_full_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
ADD_ICON_PATH = resolve_path('assets/add_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
TRASH_ICON_PATH = resolve_path('assets/delete_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
CANCEL_ICON_PATH = resolve_path('assets/cancel_FILL0_wght700_GRAD0_opsz48.svg')
|
||||
|
||||
|
||||
class AboutDialog(QDialog):
|
||||
|
|
@ -1360,6 +1354,12 @@ class Application(QApplication):
|
|||
def __init__(self) -> None:
|
||||
super().__init__(sys.argv)
|
||||
|
||||
try:
|
||||
output = subprocess.check_output([resolve_path('whisper_cpp')])
|
||||
logging.debug(f'output: {output}')
|
||||
except:
|
||||
logging.exception('')
|
||||
|
||||
self.window = MainWindow()
|
||||
self.window.show()
|
||||
|
||||
|
|
|
|||
10
buzz/path.py
Normal file
10
buzz/path.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def resolve_path(path: str):
|
||||
"""Returns the absolute path to the given file or folder. It handles the path resolution both when the app is run
|
||||
directly through Python and when it is bundled via PyInstaller."""
|
||||
if getattr(sys, 'frozen', False):
|
||||
return os.path.join(os.path.dirname(sys.executable), path)
|
||||
return os.path.join(os.path.dirname(__file__), '..', path)
|
||||
|
|
@ -29,6 +29,7 @@ from sounddevice import PortAudioError
|
|||
from . import transformers_whisper
|
||||
from .conn import pipe_stderr
|
||||
from .model_loader import TranscriptionModel, ModelType
|
||||
from .path import resolve_path
|
||||
from .transformers_whisper import TransformersWhisper
|
||||
|
||||
# Catch exception from whisper.dll not getting loaded.
|
||||
|
|
@ -271,7 +272,7 @@ class WhisperCppFileTranscriber(QObject):
|
|||
logging.debug(
|
||||
'Running whisper_cpp process, args = "%s"', ' '.join(args))
|
||||
|
||||
self.process.start('./whisper_cpp', args)
|
||||
self.process.start(resolve_path('whisper_cpp'), args)
|
||||
self.process.waitForFinished()
|
||||
|
||||
# Ensure all std_out data has been read
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 4ef3398e8fe0c426de038b8c3816c6791a34a5ae
|
||||
Subproject commit ff3e3793bcbbbfe1c451c9bc169925e44667a241
|
||||
Loading…
Add table
Add a link
Reference in a new issue