Skip to content

Commit 7ae67e2

Browse files
Fixed model unloading and ensured sounddevice is reinitialized to query newly available audio devices.
1 parent 6aaa619 commit 7ae67e2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tabs/realtime/realtime.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import gradio as gr
2+
import sounddevice as sd
23
import os
34
import sys
45
import time
@@ -21,7 +22,6 @@
2122
get_speakers_id,
2223
create_folder_and_move_files,
2324
refresh_embedders_folders,
24-
custom_embedder_root_relative,
2525
model_root_relative,
2626
)
2727

@@ -472,6 +472,7 @@ def realtime_tab():
472472
value=get_safe_dropdown_value(
473473
saved_settings["model_file"], model_choices, default_weight
474474
),
475+
allow_custom_value=True,
475476
)
476477
index_choices = get_indexes()
477478
index_file = gr.Dropdown(
@@ -483,6 +484,7 @@ def realtime_tab():
483484
match_index(default_weight) if default_weight else None,
484485
),
485486
interactive=True,
487+
allow_custom_value=True,
486488
)
487489

488490
with gr.Row():
@@ -701,6 +703,9 @@ def update_on_model_change(model_path):
701703
), gr.update(choices=new_sids, value=0 if new_sids else None)
702704

703705
def refresh_devices():
706+
sd._terminate()
707+
sd._initialize()
708+
704709
input_choices, output_choices = get_audio_devices_formatted()
705710
input_choices, output_choices = list(input_choices.keys()), list(
706711
output_choices.keys()

0 commit comments

Comments
 (0)