mirror of
https://github.com/chidiwilliams/buzz.git
synced 2026-03-14 22:55:46 +01:00
Fix for windows blinking on windows (#1209)
This commit is contained in:
parent
44fc608bc6
commit
fdde496b38
4 changed files with 44 additions and 5 deletions
|
|
@ -80,7 +80,13 @@ class FileTranscriber(QObject):
|
|||
si = subprocess.STARTUPINFO()
|
||||
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
si.wShowWindow = subprocess.SW_HIDE
|
||||
result = subprocess.run(cmd, capture_output=True, startupinfo=si, env=app_env)
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
startupinfo=si,
|
||||
env=app_env,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW
|
||||
)
|
||||
else:
|
||||
result = subprocess.run(cmd, capture_output=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,13 @@ class OpenAIWhisperAPIFileTranscriber(FileTranscriber):
|
|||
si = subprocess.STARTUPINFO()
|
||||
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
si.wShowWindow = subprocess.SW_HIDE
|
||||
result = subprocess.run(cmd, capture_output=True, startupinfo=si, env=app_env)
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
startupinfo=si,
|
||||
env=app_env,
|
||||
creationflags = subprocess.CREATE_NO_WINDOW
|
||||
)
|
||||
else:
|
||||
result = subprocess.run(cmd, capture_output=True)
|
||||
|
||||
|
|
@ -83,7 +89,14 @@ class OpenAIWhisperAPIFileTranscriber(FileTranscriber):
|
|||
si.wShowWindow = subprocess.SW_HIDE
|
||||
|
||||
duration_secs = float(
|
||||
subprocess.run(cmd, capture_output=True, check=True, startupinfo=si, env=app_env).stdout.decode("utf-8")
|
||||
subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
check=True,
|
||||
startupinfo=si,
|
||||
env=app_env,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW
|
||||
).stdout.decode("utf-8"),
|
||||
)
|
||||
else:
|
||||
duration_secs = float(
|
||||
|
|
@ -126,7 +139,14 @@ class OpenAIWhisperAPIFileTranscriber(FileTranscriber):
|
|||
si = subprocess.STARTUPINFO()
|
||||
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
si.wShowWindow = subprocess.SW_HIDE
|
||||
subprocess.run(cmd, capture_output=True, check=True, startupinfo=si, env=app_env)
|
||||
subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
check=True,
|
||||
startupinfo=si,
|
||||
env=app_env,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW
|
||||
)
|
||||
else:
|
||||
subprocess.run(cmd, capture_output=True, check=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -220,6 +220,8 @@ class TransformersWhisper:
|
|||
text = chunk['text']
|
||||
|
||||
# Last segment may not have an end timestamp
|
||||
if start is None:
|
||||
start = 0
|
||||
if end is None:
|
||||
end = start + 0.1
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
import subprocess
|
||||
import numpy as np
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
|
||||
from buzz.assets import APP_BASE_DIR
|
||||
|
||||
SAMPLE_RATE = 16000
|
||||
|
||||
N_FFT = 400
|
||||
|
|
@ -10,6 +13,8 @@ HOP_LENGTH = 160
|
|||
CHUNK_LENGTH = 30
|
||||
N_SAMPLES = CHUNK_LENGTH * SAMPLE_RATE # 480000 samples in a 30-second chunk
|
||||
|
||||
app_env = os.environ.copy()
|
||||
app_env['PATH'] = os.pathsep.join([os.path.join(APP_BASE_DIR, "_internal")] + [app_env['PATH']])
|
||||
|
||||
def load_audio(file: str, sr: int = SAMPLE_RATE):
|
||||
"""
|
||||
|
|
@ -48,7 +53,13 @@ def load_audio(file: str, sr: int = SAMPLE_RATE):
|
|||
si = subprocess.STARTUPINFO()
|
||||
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
si.wShowWindow = subprocess.SW_HIDE
|
||||
result = subprocess.run(cmd, capture_output=True, startupinfo=si)
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
startupinfo=si,
|
||||
env=app_env,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW
|
||||
)
|
||||
else:
|
||||
result = subprocess.run(cmd, capture_output=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue