Spaces:
Runtime error
Runtime error
ehcalabres
commited on
Commit
•
461ed82
1
Parent(s):
65071f8
Added audio input and example selection
Browse files- app.py +23 -1
- data/test_example.wav +0 -0
- img/love_emoji.png +0 -0
- img/love_emoji_128.png +0 -0
app.py
CHANGED
@@ -1,8 +1,30 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
st.sidebar.title('EMOVoice')
|
4 |
st.sidebar.write('Welcome to EMOVoice, a tool for Speech Emotion Recognition based on the Wav2Vec2 model.')
|
5 |
|
6 |
st.title('EMOVoice')
|
7 |
-
|
8 |
st.write("This is a work in progress, stay tuned!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
import streamlit as st
|
3 |
|
4 |
+
EXAMPLE_PATH = []
|
5 |
+
for f in os.listdir('data/'):
|
6 |
+
EXAMPLE_PATH.append(f)
|
7 |
+
|
8 |
+
st.sidebar.image('img/love_emoji_128.png')
|
9 |
st.sidebar.title('EMOVoice')
|
10 |
st.sidebar.write('Welcome to EMOVoice, a tool for Speech Emotion Recognition based on the Wav2Vec2 model.')
|
11 |
|
12 |
st.title('EMOVoice')
|
|
|
13 |
st.write("This is a work in progress, stay tuned!")
|
14 |
+
|
15 |
+
st.sidebar.subheader('Model input')
|
16 |
+
input_mode = st.sidebar.radio('Select your input mode:', ['Upload audio', 'Select example'])
|
17 |
+
|
18 |
+
file = None
|
19 |
+
|
20 |
+
if input_mode == 'Upload audio':
|
21 |
+
file = st.sidebar.file_uploader("Choose a file", type=['mp3', 'mp4', 'wav', 'flac'])
|
22 |
+
elif input_mode == 'Select example':
|
23 |
+
example_selected = st.sidebar.selectbox('Choose an audio example', EXAMPLE_PATH)
|
24 |
+
file = open('data/' + example_selected, 'rb')
|
25 |
+
|
26 |
+
if file is not None:
|
27 |
+
st.write('Audio added!')
|
28 |
+
audio_bytes = file.read()
|
29 |
+
st.audio(audio_bytes)
|
30 |
+
file.close()
|
data/test_example.wav
ADDED
Binary file (376 kB). View file
|
|
img/love_emoji.png
ADDED
img/love_emoji_128.png
ADDED