I’ve built a streamlit app for classification of music genre. It’s working good on wav format audio so how to make prediction using MP3 files. Also how to save the uploaded audio file using streamlit for further use.
To convert mp3 to wav use the following code,
from pydub import AudioSegment sound = AudioSegment.from_mp3("/path/to/file.mp3") sound.export("/output/path/file.wav", format="wav")
Hope this helps.
Thanks @sree369nidhi it worked I saved the audio file in wav format gave the path to that model and then deleted the file using os library. Thanks for your help. I’ll share the link of my deployed app soon.