import streamlit as st import tempfile import os st.title("🎵 Audio Upload App") # File uploader accepts audio files audio_file = st.file_uploader("Upload an audio file", type=["wav", "mp3", "ogg", "m4a"]) if audio_file is not None: # Save the uploaded file to a temporary file with tempfile.NamedTemporaryFile(delete=False) as tmp_file: tmp_file.write(audio_file.read()) tmp_file_path = tmp_file.name st.audio(tmp_file_path, format='audio/wav') # Optional: Display file details st.write("Filename:", audio_file.name) st.write("File type:", audio_file.type) st.write("File size:", audio_file.size, "bytes") # Clean up the temporary file os.remove(tmp_file_path)