From 351b5fe0ca8402160839087fdfffcae59aee5b0c Mon Sep 17 00:00:00 2001 From: Viet-Anh Nguyen Date: Sun, 6 Oct 2024 18:14:18 +0700 Subject: [PATCH] Add ffmpeg-python as dep --- llama_assistant/speech_recognition_thread.py | 6 ++++-- pyproject.toml | 3 ++- requirements.txt | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/llama_assistant/speech_recognition_thread.py b/llama_assistant/speech_recognition_thread.py index ef3ab69..e11c7f5 100644 --- a/llama_assistant/speech_recognition_thread.py +++ b/llama_assistant/speech_recognition_thread.py @@ -1,7 +1,7 @@ -from pathlib import Path import time import os import re +import traceback from PyQt5.QtCore import QThread, pyqtSignal import pyaudio @@ -71,7 +71,6 @@ def run(self): # Transcribe audio res = self.whisper.transcribe(str(tmp_filepath)) transcription = self.whisper.extract_text(res) - os.remove(tmp_filepath) if isinstance(transcription, list): # Remove all "[BLANK_AUDIO]" from the transcription @@ -82,7 +81,10 @@ def run(self): if transcription.strip(): # Only emit if there's non-empty transcription self.finished.emit(transcription) + os.remove(tmp_filepath) + except Exception as e: + traceback.print_exc() self.error.emit(f"An error occurred: {str(e)}") finally: stream.stop_stream() diff --git a/pyproject.toml b/pyproject.toml index bc8ba37..5493ea3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "llama-assistant" -version = "0.1.33" +version = "0.1.35" authors = [ {name = "Viet-Anh Nguyen", email = "vietanh.dev@gmail.com"}, ] @@ -25,6 +25,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] dependencies = [ + "ffmpeg-python", "PyQt5", "markdown", "llama-cpp-python", diff --git a/requirements.txt b/requirements.txt index 4435f0d..8aaf209 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,5 @@ llama-cpp-python==0.3.1 huggingface_hub==0.25.1 openwakeword==0.6.0 pyinstaller==6.10.0 +ffmpeg-python==0.2.0 git+https://github.com/stlukey/whispercpp.py \ No newline at end of file