Skip to content

feat: enable non-blocking transcription saving#72

Open
chc-tw wants to merge 2 commits intodavabase:masterfrom
chc-tw:master
Open

feat: enable non-blocking transcription saving#72
chc-tw wants to merge 2 commits intodavabase:masterfrom
chc-tw:master

Conversation

@chc-tw
Copy link
Copy Markdown

@chc-tw chc-tw commented Jan 16, 2025

This pull request introduces asynchronous functionality to the transcribe_demo.py script, allowing for non-blocking operations and periodic saving of transcriptions. The most important changes include adding a coroutine for saving transcripts, modifying the main function to use asyncio, and updating the recording callback to accommodate asynchronous behavior.

Asynchronous Functionality:

  • Added save_transcript coroutine to save the transcript to a file periodically.
  • Modified the main function to use asyncio.run for running the asynchronous main function.

Command Line Arguments:

  • Added --output_file argument to specify the file to save the transcript to.

Recording Callback Updates:

  • Started the save_transcript coroutine within the record_callback function using asyncio.create_task.
  • Replaced sleep calls with await asyncio.sleep to allow other coroutines to run and prevent blocking.
  • Ensured the save task is canceled and awaited before exiting the program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant