Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Windows setup --server --local: TTS and STT #173

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion software/source/server/services/stt/local-whisper/stt.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def install(service_dir):
# Check if whisper-rust executable exists before attempting to build
if not os.path.isfile(os.path.join(WHISPER_RUST_PATH, "target/release/whisper-rust")):
# Check if Rust is installed. Needed to build whisper executable
rustc_path = shutil.which('rustc')

rustc_path = shutil.which("rustc")

if rustc_path is None:
print("Rust is not installed or is not in system PATH. Please install Rust before proceeding.")
exit(1)
Expand Down
11 changes: 6 additions & 5 deletions software/source/server/services/tts/piper/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,23 @@ def install(self, service_directory):
return
elif OS == "Windows":
if ARCH == "AMD64":
ARCH = "x64"
ARCH = "amd64"
else:
print("Piper: unsupported architecture")
return

PIPER_ASSETNAME = f"piper_{OS}_{ARCH}.tar.gz"
PIPER_URL = "https://github.com/rhasspy/piper/releases/latest/download/"

if OS == "windows":
asset_url = f"{PIPER_URL}{PIPER_ASSETNAME}".replace(".tar.gz", ".zip")
asset_url = f"{PIPER_URL}{PIPER_ASSETNAME}"
if OS == "Windows":
asset_url = asset_url.replace(".tar.gz", ".zip")

# Download and extract Piper
urllib.request.urlretrieve(asset_url, os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME))

# Extract the downloaded file
if OS == "windows":
if OS == "Windows":
import zipfile
with zipfile.ZipFile(os.path.join(PIPER_FOLDER_PATH, PIPER_ASSETNAME), 'r') as zip_ref:
zip_ref.extractall(path=PIPER_FOLDER_PATH)
Expand Down Expand Up @@ -105,4 +106,4 @@ def install(self, service_directory):

print("Piper setup completed.")
else:
print("Piper already set up. Skipping download.")
print("Piper already set up. Skipping download.")
24 changes: 14 additions & 10 deletions software/source/server/utils/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,20 @@ def custom_filter(message):

def check_filtered_kernel():
messages = get_kernel_messages()
if messages:
messages.replace(last_messages, "")
messages = messages.split("\n")

filtered_messages = []
for message in messages:
if custom_filter(message):
filtered_messages.append(message)

return "\n".join(filtered_messages)
if messages is None:
return "" # Handle unsupported platform or error in fetching kernel messages

global last_messages
messages.replace(last_messages, "")
messages = messages.split("\n")

filtered_messages = []
for message in messages:
if custom_filter(message):
filtered_messages.append(message)

return "\n".join(filtered_messages)


async def put_kernel_messages_into_queue(queue):
while True:
Expand Down