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