Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ else:
|
|
20 |
button_click = st.button("Run Analysis", type="primary")
|
21 |
|
22 |
# load song
|
23 |
-
output_file = ""
|
24 |
|
25 |
# preprocess and crop audio file
|
26 |
def audio_preprocess():
|
@@ -32,15 +32,15 @@ def audio_preprocess():
|
|
32 |
start_time = 60000 # e.g. 30 seconds, 30000
|
33 |
end_time = 110000 # e.g. 40 seconds, 40000
|
34 |
|
35 |
-
audio = AudioSegment.from_file('vocals.wav')
|
36 |
cropped_audio = audio[start_time:end_time]
|
37 |
-
cropped_audio.export('cropped_vocals.wav', format='wav') # save vocal audio file
|
38 |
|
39 |
|
40 |
# ASR transcription
|
41 |
def asr_model():
|
42 |
# load audio file
|
43 |
-
y, sr = librosa.load('cropped_vocals.wav', sr=16000)
|
44 |
|
45 |
# ASR model
|
46 |
MODEL_NAME = "RexChan/ISOM5240-whisper-small-zhhk_1"
|
|
|
20 |
button_click = st.button("Run Analysis", type="primary")
|
21 |
|
22 |
# load song
|
23 |
+
output_file = "/ISOM5240_Group25/"
|
24 |
|
25 |
# preprocess and crop audio file
|
26 |
def audio_preprocess():
|
|
|
32 |
start_time = 60000 # e.g. 30 seconds, 30000
|
33 |
end_time = 110000 # e.g. 40 seconds, 40000
|
34 |
|
35 |
+
audio = AudioSegment.from_file('/ISOM5240_Group25/vocals.wav')
|
36 |
cropped_audio = audio[start_time:end_time]
|
37 |
+
cropped_audio.export('/ISOM5240_Group25/cropped_vocals.wav', format='wav') # save vocal audio file
|
38 |
|
39 |
|
40 |
# ASR transcription
|
41 |
def asr_model():
|
42 |
# load audio file
|
43 |
+
y, sr = librosa.load('/ISOM5240_Group25/cropped_vocals.wav', sr=16000)
|
44 |
|
45 |
# ASR model
|
46 |
MODEL_NAME = "RexChan/ISOM5240-whisper-small-zhhk_1"
|