Closed millawell closed 2 years ago
This solution is much faster and works. Just that there are some weird errors on the Python side.
const blob = await fetch(data.url).then(r => r.blob());
const blobData = await blob.arrayBuffer();
Streamlit.setComponentValue(blobData)
audiorec_data = st_audiorec()
if audiorec_data is not None:
wav_data = audiorec_data
with open(f1, 'w+b') as fh:
fh.write(wav_data)
I mean numpy is only used in that example which is totally not necessary, what one would do in the app is totally up to the user :)
@millawell Haha, totally agreed. I found that if we can pass the arrayBuffer
directly to the Python side, the frontend handling seems be much faster.
I am using the following solution. I hope to avoid using
numpy
. Of course, we don't have to save the data to a file if that is not required. A potential issue is that sending data from Javascript to Python seems quite slow.