mirror of
https://github.com/chidiwilliams/buzz.git
synced 2024-06-26 11:40:09 +02:00
Refactor module structure (#192)
This commit is contained in:
parent
219f20d0e2
commit
f358809043
|
@ -1,6 +1,6 @@
|
|||
[run]
|
||||
omit =
|
||||
whisper_cpp.py
|
||||
buzz/whisper_cpp.py
|
||||
*_test.py
|
||||
|
||||
[html]
|
||||
|
|
12
Makefile
12
Makefile
|
@ -43,18 +43,18 @@ endif
|
|||
|
||||
clean:
|
||||
rm -f $(LIBWHISPER)
|
||||
rm -f whisper_cpp.py
|
||||
rm -f buzz/whisper_cpp.py
|
||||
rm -rf dist/* || true
|
||||
|
||||
test: whisper_cpp.py
|
||||
test: buzz/whisper_cpp.py
|
||||
pytest --cov --cov-report=html
|
||||
|
||||
dist/Buzz dist/Buzz.app: whisper_cpp.py
|
||||
dist/Buzz dist/Buzz.app: buzz/whisper_cpp.py
|
||||
pyinstaller --noconfirm Buzz.spec
|
||||
|
||||
version:
|
||||
poetry version ${version}
|
||||
echo "VERSION = \"${version}\"" > __version__.py
|
||||
echo "VERSION = \"${version}\"" > buzz/__version__.py
|
||||
sed -i "s/version=.*,/version=\'${version_escaped}\',/" Buzz.spec
|
||||
|
||||
CMAKE_FLAGS=
|
||||
|
@ -79,8 +79,8 @@ $(LIBWHISPER):
|
|||
cp whisper.cpp/build/$(LIBWHISPER) . || true
|
||||
cp whisper.cpp/build/bin/Debug/$(LIBWHISPER) . || true
|
||||
|
||||
whisper_cpp.py: $(LIBWHISPER)
|
||||
ctypesgen ./whisper.cpp/whisper.h -l$(LIBWHISPER) -o whisper_cpp.py
|
||||
buzz/whisper_cpp.py: $(LIBWHISPER)
|
||||
ctypesgen ./whisper.cpp/whisper.h -l$(LIBWHISPER) -o buzz/whisper_cpp.py
|
||||
|
||||
staple_app_mac:
|
||||
xcrun stapler staple ${mac_app_path}
|
||||
|
|
0
buzz/__init__.py
Normal file
0
buzz/__init__.py
Normal file
|
@ -20,10 +20,10 @@ from PyQt6.QtWidgets import (QApplication, QCheckBox, QComboBox, QDialog,
|
|||
from requests import get
|
||||
from whisper import tokenizer
|
||||
|
||||
from __version__ import VERSION
|
||||
from transcriber import FileTranscriber, OutputFormat, RecordingTranscriber
|
||||
from whispr import LOADED_WHISPER_DLL, Task
|
||||
from model_loader import ModelLoader
|
||||
from .__version__ import VERSION
|
||||
from .transcriber import FileTranscriber, OutputFormat, RecordingTranscriber
|
||||
from .whispr import LOADED_WHISPER_DLL, Task
|
||||
from .model_loader import ModelLoader
|
||||
|
||||
APP_NAME = 'Buzz'
|
||||
|
|
@ -18,8 +18,9 @@ import stable_whisper
|
|||
import whisper
|
||||
from sounddevice import PortAudioError
|
||||
|
||||
from conn import pipe_stderr, pipe_stdout
|
||||
from whispr import Segment, Task, WhisperCpp, read_progress, whisper_cpp_params
|
||||
from .conn import pipe_stderr, pipe_stdout
|
||||
from .whispr import (Segment, Task, WhisperCpp, read_progress,
|
||||
whisper_cpp_params)
|
||||
|
||||
|
||||
class RecordingTranscriber:
|
|
@ -14,7 +14,7 @@ import whisper
|
|||
# the DLL in some envs is fixed.
|
||||
LOADED_WHISPER_DLL = False
|
||||
try:
|
||||
import whisper_cpp
|
||||
import buzz.whisper_cpp as whisper_cpp
|
||||
LOADED_WHISPER_DLL = True
|
||||
except ImportError:
|
||||
logging.exception('')
|
2
main.py
2
main.py
|
@ -34,6 +34,6 @@ if __name__ == "__main__":
|
|||
level=logging.DEBUG,
|
||||
format="[%(asctime)s] %(module)s.%(funcName)s:%(lineno)d %(levelname)s -> %(message)s")
|
||||
|
||||
from gui import Application
|
||||
from buzz.gui import Application
|
||||
app = Application()
|
||||
sys.exit(app.exec())
|
||||
|
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
|
@ -5,11 +5,12 @@ from unittest.mock import patch
|
|||
import sounddevice
|
||||
from PyQt6.QtCore import Qt
|
||||
|
||||
from gui import (Application, AudioDevicesComboBox,
|
||||
DownloadModelProgressDialog, FileTranscriberWidget,
|
||||
LanguagesComboBox, MainWindow, OutputFormatsComboBox, Quality, Settings, AboutDialog,
|
||||
QualityComboBox, TranscriberProgressDialog)
|
||||
from transcriber import OutputFormat
|
||||
from buzz.gui import (AboutDialog, Application, AudioDevicesComboBox,
|
||||
DownloadModelProgressDialog, FileTranscriberWidget,
|
||||
LanguagesComboBox, MainWindow, OutputFormatsComboBox,
|
||||
Quality, QualityComboBox, Settings,
|
||||
TranscriberProgressDialog)
|
||||
from buzz.transcriber import OutputFormat
|
||||
|
||||
|
||||
class TestApplication:
|
|
@ -1,4 +1,3 @@
|
|||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import tempfile
|
||||
|
@ -6,10 +5,10 @@ import time
|
|||
|
||||
import pytest
|
||||
|
||||
from model_loader import ModelLoader
|
||||
from transcriber import (FileTranscriber, OutputFormat, RecordingTranscriber,
|
||||
to_timestamp)
|
||||
from whispr import Task
|
||||
from buzz.model_loader import ModelLoader
|
||||
from buzz.transcriber import (FileTranscriber, OutputFormat,
|
||||
RecordingTranscriber, to_timestamp)
|
||||
from buzz.whispr import Task
|
||||
|
||||
|
||||
def get_model_path(model_name: str, use_whisper_cpp: bool) -> str:
|
Loading…
Reference in a new issue