diff --git a/assets/i18n/languages/en_US.json b/assets/i18n/languages/en_US.json index 0f9861d4..1120f3f5 100644 --- a/assets/i18n/languages/en_US.json +++ b/assets/i18n/languages/en_US.json @@ -306,5 +306,7 @@ "Move files to custom embedder folder": "Move files to custom embedder folder", "model information": "model information", "Model Creator": "Model Creator", - "Name of the model creator. (Default: Unknown)": "Name of the model creator. (Default: Unknown)" -} \ No newline at end of file + "Name of the model creator. (Default: Unknown)": "Name of the model creator. (Default: Unknown)", + "Speaker ID": "Speaker ID", + "Select the speaker ID to use for the conversion.": "Select the speaker ID to use for the conversion." +} diff --git a/tabs/inference/inference.py b/tabs/inference/inference.py index 10ffbb75..42be0bc7 100644 --- a/tabs/inference/inference.py +++ b/tabs/inference/inference.py @@ -174,7 +174,11 @@ def output_path_fn(input_audio_path): return output_path -def change_choices(): +def change_choices(model): + if model: + speakers = get_speakers_id(model) + else: + speakers = 0 names = [ os.path.join(root, file) for root, _, files in os.walk(model_root_relative, topdown=False) @@ -205,6 +209,7 @@ def change_choices(): {"choices": sorted(names), "__type__": "update"}, {"choices": sorted(indexes_list), "__type__": "update"}, {"choices": sorted(audio_paths), "__type__": "update"}, + {"choices": sorted(speakers), "__type__": "update"}, ) @@ -304,7 +309,7 @@ def get_speakers_id(model): if model: model_data = torch.load(model, map_location="cpu") speakers_id = model_data.get("speakers_id", 0) - return list(range(speakers_id + 1)) + return list(range(speakers_id)) # Inference tab @@ -1928,11 +1933,12 @@ def delay_visible(checkbox): ) refresh_button.click( fn=change_choices, - inputs=[], + inputs=[model_file], outputs=[ model_file, index_file, audio, + sid, ], ) audio.change(