Skip to content

Commit

Permalink
folders in segments tab each have their own statekey now
Browse files Browse the repository at this point in the history
  • Loading branch information
max-mauermann committed Aug 26, 2024
1 parent 7946d2a commit 344a570
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1465,16 +1465,16 @@ def build_segments_tab():
result_directory_state = gr.State()
output_directory_state = gr.State()

def select_directory_to_state_and_tb():
return (select_directory(collect_files=False, state_key="segments-data-dir"),) * 2
def select_directory_to_state_and_tb(state_key):
return (select_directory(collect_files=False, state_key=state_key),) * 2

with gr.Row():
select_audio_directory_btn = gr.Button(
loc.localize("segments-tab-select-audio-input-directory-button-label")
)
selected_audio_directory_tb = gr.Textbox(show_label=False, interactive=False)
select_audio_directory_btn.click(
select_directory_to_state_and_tb,
partial(select_directory_to_state_and_tb, state_key="segments-audio-dir"),
outputs=[selected_audio_directory_tb, audio_directory_state],
show_progress=False,
)
Expand All @@ -1489,7 +1489,7 @@ def select_directory_to_state_and_tb():
placeholder=loc.localize("segments-tab-results-input-textbox-placeholder"),
)
select_result_directory_btn.click(
select_directory_to_state_and_tb,
partial(select_directory_to_state_and_tb, state_key="segments-result-dir"),
outputs=[result_directory_state, selected_result_directory_tb],
show_progress=False,
)
Expand All @@ -1502,7 +1502,7 @@ def select_directory_to_state_and_tb():
placeholder=loc.localize("segments-tab-output-selection-textbox-placeholder"),
)
select_output_directory_btn.click(
select_directory_to_state_and_tb,
partial(select_directory_to_state_and_tb, state_key="segments-output-dir"),
outputs=[selected_output_directory_tb, output_directory_state],
show_progress=False,
)
Expand Down

0 comments on commit 344a570

Please sign in to comment.