tsi-org commited on
Commit
468df4c
·
verified ·
1 Parent(s): 7451238

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -30,9 +30,13 @@ def check_password():
30
 
31
 
32
  def save_temporary_audio_file(uploaded_file):
33
- with tempfile.NamedTemporaryFile(delete=False, suffix=".wav", mode='wb') as tmpfile: # Ensure mode is 'wb' for binary write
 
 
 
 
34
  # Read content from the uploaded file and write it to the temporary file
35
- file_content = uploaded_file.read() # Use .read() to get the file content
36
  tmpfile.write(file_content)
37
  return tmpfile.name
38
 
 
30
 
31
 
32
  def save_temporary_audio_file(uploaded_file):
33
+ """
34
+ Saves the uploaded audio file to a temporary file and returns its path.
35
+ Assumes 'uploaded_file' is a file-like object (e.g., from Streamlit's file_uploader).
36
+ """
37
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".wav", mode='wb') as tmpfile:
38
  # Read content from the uploaded file and write it to the temporary file
39
+ file_content = uploaded_file.read()
40
  tmpfile.write(file_content)
41
  return tmpfile.name
42