Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ st.header("Cantonese Song Sentiment Analyzer")
|
|
15 |
|
16 |
# load song
|
17 |
input_file = ""
|
18 |
-
output_file = "
|
19 |
|
20 |
# preprocess and crop audio file
|
21 |
def audio_preprocess():
|
@@ -27,15 +27,15 @@ def audio_preprocess():
|
|
27 |
start_time = 60000 # e.g. 30 seconds, 30000
|
28 |
end_time = 110000 # e.g. 40 seconds, 40000
|
29 |
|
30 |
-
audio = AudioSegment.from_file('
|
31 |
cropped_audio = audio[start_time:end_time]
|
32 |
-
cropped_audio.export('
|
33 |
|
34 |
|
35 |
# ASR transcription
|
36 |
def asr_model():
|
37 |
# load audio file
|
38 |
-
y, sr = librosa.load('
|
39 |
|
40 |
# ASR model
|
41 |
MODEL_NAME = "RexChan/ISOM5240-whisper-small-zhhk_1"
|
|
|
15 |
|
16 |
# load song
|
17 |
input_file = ""
|
18 |
+
output_file = ""
|
19 |
|
20 |
# preprocess and crop audio file
|
21 |
def audio_preprocess():
|
|
|
27 |
start_time = 60000 # e.g. 30 seconds, 30000
|
28 |
end_time = 110000 # e.g. 40 seconds, 40000
|
29 |
|
30 |
+
audio = AudioSegment.from_file('vocals.wav')
|
31 |
cropped_audio = audio[start_time:end_time]
|
32 |
+
cropped_audio.export('cropped_vocals.wav', format='wav') # save vocal audio file
|
33 |
|
34 |
|
35 |
# ASR transcription
|
36 |
def asr_model():
|
37 |
# load audio file
|
38 |
+
y, sr = librosa.load('cropped_vocals.wav', sr=16000)
|
39 |
|
40 |
# ASR model
|
41 |
MODEL_NAME = "RexChan/ISOM5240-whisper-small-zhhk_1"
|