duongthienz commited on
Commit
c5f7be3
·
verified ·
1 Parent(s): 21a519f

Visual update on multi-file submenu

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -254,8 +254,14 @@ try:
254
  catColors = allColors[len(speakerNames):]
255
 
256
  # Rebuild live df4
 
 
257
  nameList = st.session_state.categories
258
- valueList = [su.sumTimes(currAnnotation.subset(s)) for s in categorySelections]
 
 
 
 
259
  extraNames = list(unusedSpeakers)
260
  extraValues = [su.sumTimes(currAnnotation.subset([sp])) for sp in unusedSpeakers]
261
  st.session_state.summaries[currFile]["df4"] = pd.DataFrame(
 
254
  catColors = allColors[len(speakerNames):]
255
 
256
  # Rebuild live df4
257
+ # Guard: trim categorySelections to match categories length in case they
258
+ # are momentarily out of sync during rapid role assignments.
259
  nameList = st.session_state.categories
260
+ _selections = categorySelections[:len(nameList)]
261
+ while len(_selections) < len(nameList):
262
+ _selections.append([])
263
+ valueList = [su.sumTimes(currAnnotation.subset(s)) for s in _selections]
264
+ categorySelections = _selections
265
  extraNames = list(unusedSpeakers)
266
  extraValues = [su.sumTimes(currAnnotation.subset([sp])) for sp in unusedSpeakers]
267
  st.session_state.summaries[currFile]["df4"] = pd.DataFrame(