czyoung commited on
Commit
aea5330
·
verified ·
1 Parent(s): ff880c3

Correct streamlit file behavior

Browse files

Corrected processing of streamlit uploaded file names

Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -7,18 +7,18 @@ import time
7
 
8
  st.title("Lecturer Support Tool")
9
 
10
- file_name = st.file_uploader("Upload an audio of classroom activity to analyze")
11
 
12
  supported_file_types = ['.wav','.mp3','.mp4']
13
 
14
- if file_name is not None:
15
- if not file_name.endswith(supported_file_types):
16
  st.error('File must be of type: {}'.format(supported_file_types))
17
- file_name = st.empty()
18
  else:
19
- st.audio(file_name)
20
  if st.button("Analyze Audio"):
21
- if file_name is None:
22
  st.error('Upload a file first!')
23
  else:
24
  # Process
 
7
 
8
  st.title("Lecturer Support Tool")
9
 
10
+ uploaded_file = st.file_uploader("Upload an audio of classroom activity to analyze")
11
 
12
  supported_file_types = ['.wav','.mp3','.mp4']
13
 
14
+ if uploaded_file is not None:
15
+ if not uploaded_file.name.endswith(supported_file_types):
16
  st.error('File must be of type: {}'.format(supported_file_types))
17
+ uploaded_file = st.empty()
18
  else:
19
+ st.audio(uploaded_file)
20
  if st.button("Analyze Audio"):
21
+ if uploaded_file is None:
22
  st.error('Upload a file first!')
23
  else:
24
  # Process