Leo Liu
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -101,11 +101,13 @@ def main():
|
|
101 |
uploaded_file = st.file_uploader("📤 Please upload your Cantonese customer service audio file", type=["wav", "mp3", "flac"])
|
102 |
|
103 |
if uploaded_file is not None:
|
104 |
-
file_type = magic.from_buffer(uploaded_file.
|
|
|
105 |
if not file_type.startswith("audio/"):
|
106 |
-
st.error("⚠️ Sorry, the uploaded file format is not supported. Please upload an audio file
|
107 |
return
|
108 |
|
|
|
109 |
st.audio(uploaded_file, format="audio/wav")
|
110 |
temp_audio_path = "uploaded_audio.wav"
|
111 |
with open(temp_audio_path, "wb") as f:
|
|
|
101 |
uploaded_file = st.file_uploader("📤 Please upload your Cantonese customer service audio file", type=["wav", "mp3", "flac"])
|
102 |
|
103 |
if uploaded_file is not None:
|
104 |
+
file_type = magic.from_buffer(uploaded_file.read(), mime=True)
|
105 |
+
uploaded_file.seek(0) # Reset pointer for further reading
|
106 |
if not file_type.startswith("audio/"):
|
107 |
+
st.error("⚠️ Sorry, the uploaded file format is not supported. Please upload an audio file.")
|
108 |
return
|
109 |
|
110 |
+
|
111 |
st.audio(uploaded_file, format="audio/wav")
|
112 |
temp_audio_path = "uploaded_audio.wav"
|
113 |
with open(temp_audio_path, "wb") as f:
|