czyoung commited on
Commit
611230a
·
verified ·
1 Parent(s): a996766

Correct button and tab functionality

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -56,18 +56,19 @@ if uploaded_file_paths is not None:
56
  else:
57
  if uploaded_file not in valid_files:
58
  valid_files.append(uploaded_file)
59
- audio_tabs = st.tabs([f.name for f in valid_files])
 
60
 
61
- for tab in audio_tabs:
62
- if tab.button("Analyze Audio"):
63
  if uploaded_file is None:
64
  tab.error('Upload a file first!')
65
  else:
66
  # Process
67
  # Pretend to take time as an example
68
- with tab.spinner(text='NOT ACTUALLY ANALYZING, JUST A FILLER ANIMATION'):
69
  time.sleep(5)
70
- tab.success('Done')
71
 
72
  # RTTM load as filler
73
  speakerList, annotations = su.loadAudioRTTM("24F CHEM1402 Night Class Week 4.rttm")
 
56
  else:
57
  if uploaded_file not in valid_files:
58
  valid_files.append(uploaded_file)
59
+ if len(valid_files) > 0:
60
+ audio_tabs = st.tabs([f.name for f in valid_files])
61
 
62
+ for j, tab in enumerate(audio_tabs):
63
+ if tab.button("Analyze Audio",key=f"button_{j}"):
64
  if uploaded_file is None:
65
  tab.error('Upload a file first!')
66
  else:
67
  # Process
68
  # Pretend to take time as an example
69
+ with st.spinner(text='NOT ACTUALLY ANALYZING, JUST A FILLER ANIMATION'):
70
  time.sleep(5)
71
+ st.success('Done')
72
 
73
  # RTTM load as filler
74
  speakerList, annotations = su.loadAudioRTTM("24F CHEM1402 Night Class Week 4.rttm")