Saving an audio file to S3
harsha_dataiku
Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 4 ✭
Hi, I am trying to perform a Text-to-Speech conversion task, I am able to convert the text using the gTTS library in python, but when I am trying to save it to a S3 folder. I am getting an empty file. But saving it locally and playing in the notebook works. Let me know if there is a way to save audio files in S3. Thanks. Attaching the code for reference.
Best Answer
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,160 Neuron
Please use the code button to insert code snippets in your post (the </> icon in the toolbar, see sample below) so they can be easily copy/pasted.
Your results are expected since this line:
Audio_Folder.upload_stream("welcome.mp3", myobj.save("welcome.mp3"))
expects a file like object which is not what myobj.save() method returns. Try with this approach:
https://stackoverflow.com/questions/51164040/gtts-direct-output