Spaces:
Runtime error
Runtime error
khairul ichsan commited on
Commit ·
dfa4dfd
1
Parent(s): dcd1382
Add application file
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# streamlit_audio_recorder by stefanrmmr (rs. analytics) - version January 2023
|
| 2 |
|
| 3 |
import streamlit as st
|
| 4 |
-
|
| 5 |
|
| 6 |
# DESIGN implement changes to the standard streamlit UI/UX
|
| 7 |
# --> optional, not relevant for the functionality of the component!
|
|
@@ -34,7 +34,7 @@ def audiorec_demo_app():
|
|
| 34 |
# by calling this function an instance of the audio recorder is created
|
| 35 |
# once a recording is completed, audio data will be saved to wav_audio_data
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
# add some spacing and informative messages
|
| 40 |
col_info, col_space = st.columns([0.57, 0.43])
|
|
@@ -46,11 +46,11 @@ def audiorec_demo_app():
|
|
| 46 |
' been processed. [This informative message is not part of'
|
| 47 |
' the audio recorder and can be removed easily] 🎈')
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
|
| 56 |
if __name__ == '__main__':
|
|
|
|
| 1 |
# streamlit_audio_recorder by stefanrmmr (rs. analytics) - version January 2023
|
| 2 |
|
| 3 |
import streamlit as st
|
| 4 |
+
from st_audiorec import st_audiorec
|
| 5 |
|
| 6 |
# DESIGN implement changes to the standard streamlit UI/UX
|
| 7 |
# --> optional, not relevant for the functionality of the component!
|
|
|
|
| 34 |
# by calling this function an instance of the audio recorder is created
|
| 35 |
# once a recording is completed, audio data will be saved to wav_audio_data
|
| 36 |
|
| 37 |
+
wav_audio_data = st_audiorec() # tadaaaa! yes, that's it! :D
|
| 38 |
|
| 39 |
# add some spacing and informative messages
|
| 40 |
col_info, col_space = st.columns([0.57, 0.43])
|
|
|
|
| 46 |
' been processed. [This informative message is not part of'
|
| 47 |
' the audio recorder and can be removed easily] 🎈')
|
| 48 |
|
| 49 |
+
if wav_audio_data is not None:
|
| 50 |
+
# display audio data as received on the Python side
|
| 51 |
+
col_playback, col_space = st.columns([0.58,0.42])
|
| 52 |
+
with col_playback:
|
| 53 |
+
st.audio(wav_audio_data, format='audio/wav')
|
| 54 |
|
| 55 |
|
| 56 |
if __name__ == '__main__':
|