Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,9 +30,13 @@ def check_password():
|
|
30 |
|
31 |
|
32 |
def save_temporary_audio_file(uploaded_file):
|
33 |
-
|
|
|
|
|
|
|
|
|
34 |
# Read content from the uploaded file and write it to the temporary file
|
35 |
-
file_content = uploaded_file.read()
|
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 |
|