duongthienz commited on
Commit
7fd5c99
·
verified ·
1 Parent(s): 0587214

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -263,19 +263,29 @@ try:
263
  )
264
 
265
  # Build all_speaker_tokens for rename sidebar
 
 
266
  all_speaker_tokens = [
267
  f"{fn}: {sp}"
268
  for fn in st.session_state.file_names
269
  if fn in st.session_state.results and len(st.session_state.results[fn]) == 2
270
  for sp in st.session_state.results[fn][0].labels()
271
  ]
 
 
 
 
 
 
 
 
272
 
273
  # -----------------------------------------------------------------------
274
  # Sidebar
275
  # -----------------------------------------------------------------------
276
 
277
- ui.render_role_sidebar(all_speaker_tokens)
278
- ui.render_rename_sidebar(currFile, speakerNames, all_speaker_tokens)
279
 
280
  # -----------------------------------------------------------------------
281
  # Tab: Data
 
263
  )
264
 
265
  # Build all_speaker_tokens for rename sidebar
266
+ # raw token : "file: SPEAKER_00" (stored in data model)
267
+ # display token: "file: John" (shown in dropdowns)
268
  all_speaker_tokens = [
269
  f"{fn}: {sp}"
270
  for fn in st.session_state.file_names
271
  if fn in st.session_state.results and len(st.session_state.results[fn]) == 2
272
  for sp in st.session_state.results[fn][0].labels()
273
  ]
274
+ # Map display label -> raw token so ui.py can translate back after selection
275
+ token_display_map = {
276
+ f"{fn}: {get_display_name(sp, fn)}": f"{fn}: {sp}"
277
+ for fn in st.session_state.file_names
278
+ if fn in st.session_state.results and len(st.session_state.results[fn]) == 2
279
+ for sp in st.session_state.results[fn][0].labels()
280
+ }
281
+ display_speaker_tokens = list(token_display_map.keys())
282
 
283
  # -----------------------------------------------------------------------
284
  # Sidebar
285
  # -----------------------------------------------------------------------
286
 
287
+ ui.render_role_sidebar(display_speaker_tokens, token_display_map)
288
+ ui.render_rename_sidebar(currFile, speakerNames, display_speaker_tokens, token_display_map)
289
 
290
  # -----------------------------------------------------------------------
291
  # Tab: Data