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

feat: enable non-blocking transcription saving #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chc-tw
Copy link

@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