From 1bd6114f767468ecc2331e43c5bef8e01a7ca724 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Mon, 29 Apr 2024 13:30:46 -0400 Subject: [PATCH] Add KMP_DUPLICATE_LIB_OK flag to .env file for Windows and Linux builds --- .github/workflows/build.yaml | 2 ++ audio_capture.py | 12 +++++++++--- transcription.py | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a69a33a..3f81244 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -95,6 +95,7 @@ jobs: run: | echo "LOCAL_RELEASE_TAG=${GITHUB_REF_NAME}" >> .env echo "LOCAL_RELEASE_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> .env + echo "KMP_DUPLICATE_LIB_OK=TRUE" >> .env - name: Write .env file Windows if: matrix.os == 'windows-latest' @@ -102,6 +103,7 @@ jobs: @" LOCAL_RELEASE_TAG=$env:GITHUB_REF_NAME LOCAL_RELEASE_DATE=$(Get-Date -Format 'yyyy-MM-ddTHH:mm:ssZ') + KMP_DUPLICATE_LIB_OK=TRUE "@ | Out-File -FilePath .env -Encoding ASCII shell: pwsh diff --git a/audio_capture.py b/audio_capture.py index 3455414..8086e50 100644 --- a/audio_capture.py +++ b/audio_capture.py @@ -142,13 +142,19 @@ def get_chunk_size_frames(self): @staticmethod def get_audio_devices() -> list[AudioSource]: - devices = sd.query_devices(kind="input") + devices = sd.query_devices() + devices_list = [] if type(devices) is dict: - devices = [devices] + devices_list = [devices] + else: + for device in devices: + if device["max_input_channels"] > 0: + logger.debug(f"Audio device: {device}") + devices_list.append(device) return [ AudioSource( sourceName=device["name"], sourceType=AudioSource.SourceType.DEVICE, ) - for device in devices + for device in devices_list ] diff --git a/transcription.py b/transcription.py index 19b0be0..6eba0dd 100644 --- a/transcription.py +++ b/transcription.py @@ -62,6 +62,7 @@ def __init__(self): self.input_queue = queue.Queue() self.model = None self.running = False + self.language = None # check if model has been downloaded already checkAndDownloadModel(ModelDownloadInfo.FASTER_WHISPER_TINY_CT2)