Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- running = False # Initial state is not running
- while True: # Forever loop
- if not running:
- wait_for_button_press() # Wait for button press before starting or resuming
- running = True # Set running to True when starting or resuming
- if running:
- user_text = transcribe_audio()
- paste_text(user_text)
- while True:
- if keyboard.is_pressed('space'): # Check if space bar was pressed during transcription
- running = False # Set running to False to pause
- wait_for_button_press() # Wait for button press to toggle state
- running = True # Set running to True to resume
- break # Exit the inner loop to continue transcription
- else:
- time.sleep(0.1) # Small delay to avoid busy-waiting
- running = True # Set running to True to resume
- break # break out of this loop out to the main loop
- continue # continue from the main loop
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement