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