import streamlit as st from model import generate import numpy as np if "result" not in st.session_state: st.session_state["result"] = np.empty(16000*4) st.title("Sound Exploration") col1, col2 = st.columns(2) with col1: instrument = st.selectbox( 'Which intrument do you want ?', ('🎸 Bass', '🎺 Brass', '🪈 Flute', '🪕 Guitar', '🎹 Keyboard', '🔨 Mallet', 'Organ', 'Reed', '🎻 String', 'Synth lead', '🎙️ Vocal') ) with col2: instrument_t = st.selectbox( 'Which type intrument do you want ?', ('📯 Acoustic', '🎙️ Electronic', '🎛️ Synthetic') ) with st.expander("Magical parameters 🪄"): p1 = st.slider('p1', 0., 1., step=0.001) if st.button("Generate ✨", type="primary"): st.session_state["result"] = generate([instrument, instrument_t]) if st.session_state["result"].any(): st.audio(st.session_state["result"], sample_rate=16000)