File size: 926 Bytes
461ed82
65071f8
 
461ed82
 
 
 
 
65071f8
 
 
 
 
461ed82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import streamlit as st

EXAMPLE_PATH = []
for f in os.listdir('data/'):
    EXAMPLE_PATH.append(f)

st.sidebar.image('img/love_emoji_128.png')
st.sidebar.title('EMOVoice')
st.sidebar.write('Welcome to EMOVoice, a tool for Speech Emotion Recognition based on the Wav2Vec2 model.')

st.title('EMOVoice')
st.write("This is a work in progress, stay tuned!")

st.sidebar.subheader('Model input')
input_mode = st.sidebar.radio('Select your input mode:', ['Upload audio', 'Select example'])

file = None

if input_mode == 'Upload audio':
    file = st.sidebar.file_uploader("Choose a file", type=['mp3', 'mp4', 'wav', 'flac'])
elif input_mode == 'Select example':
    example_selected = st.sidebar.selectbox('Choose an audio example', EXAMPLE_PATH)
    file = open('data/' + example_selected, 'rb')

if file is not None:
    st.write('Audio added!')
    audio_bytes = file.read()
    st.audio(audio_bytes)
    file.close()