From f2103df380063bb4e38ce7af3b93e1665c2d3521 Mon Sep 17 00:00:00 2001 From: Bruce Stagbrook Date: Thu, 28 Nov 2024 02:20:36 -0800 Subject: [PATCH] Add iOS background task handling and Groq Whisper integration --- main.py | 4 +++- requirements.txt | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 345bd4d..29ce023 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,7 @@ from md2pdf.core import md2pdf from dotenv import load_dotenv from download import download_video_audio, delete_download +import pyobjc load_dotenv() @@ -167,6 +168,7 @@ def create_pdf_file(content: str): pdf_buffer.seek(0) return pdf_buffer +@pyobjc.background_task def transcribe_audio(audio_file): """ Transcribes audio using Groq's Whisper API. @@ -499,4 +501,4 @@ def stream_section_content(sections): # Remove audio after exception to prevent data storage leak if audio_file_path is not None: - delete_download(audio_file_path) \ No newline at end of file + delete_download(audio_file_path) diff --git a/requirements.txt b/requirements.txt index 3cbb987..dc36474 100644 --- a/requirements.txt +++ b/requirements.txt @@ -72,3 +72,5 @@ webencodings==0.5.1 websockets yt-dlp @ https://github.com/yt-dlp/yt-dlp/archive/master.tar.gz zopfli==0.2.3 +pyobjc==8.5 +groq-whisper==0.1.0