mirror of
https://github.com/SevaSk/ecoute.git
synced 2024-12-24 06:46:38 +00:00
updated clear method
This commit is contained in:
parent
02d1f12c76
commit
e0caf957e5
@ -106,3 +106,9 @@ class AudioTranscriber:
|
||||
def clear_transcript_data(self):
|
||||
self.transcript_data["You"].clear()
|
||||
self.transcript_data["Speaker"].clear()
|
||||
|
||||
self.audio_sources["You"]["last_sample"] = bytes()
|
||||
self.audio_sources["Speaker"]["last_sample"] = bytes()
|
||||
|
||||
self.audio_sources["You"]["new_phrase"] = True
|
||||
self.audio_sources["Speaker"]["new_phrase"] = True
|
6
main.py
6
main.py
@ -28,8 +28,10 @@ def update_response_UI(responder, textbox, update_interval_slider_label, update_
|
||||
|
||||
textbox.after(300, update_response_UI, responder, textbox, update_interval_slider_label, update_interval_slider)
|
||||
|
||||
def clear_transcript(transcriber):
|
||||
def clear_context(transcriber, audio_queue):
|
||||
transcriber.clear_transcript_data()
|
||||
with audio_queue.mutex:
|
||||
audio_queue.queue.clear()
|
||||
|
||||
def create_ui_components(root):
|
||||
ctk.set_appearance_mode("dark")
|
||||
@ -91,7 +93,7 @@ def main():
|
||||
root.grid_columnconfigure(1, weight=1)
|
||||
|
||||
# Add the clear transcript button to the UI
|
||||
clear_transcript_button = ctk.CTkButton(root, text="Clear Transcript", command=lambda: clear_transcript(global_transcriber, ))
|
||||
clear_transcript_button = ctk.CTkButton(root, text="Clear Transcript", command=lambda: clear_context(global_transcriber, audio_queue, ))
|
||||
clear_transcript_button.grid(row=1, column=0, padx=10, pady=3, sticky="nsew")
|
||||
|
||||
update_transcript_UI(global_transcriber, transcript_textbox)
|
||||
|
Loading…
Reference in New Issue
Block a user