RexChan commited on
Commit
78425de
1 Parent(s): da6a573

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -12,16 +12,16 @@ import accelerate
12
  # steamlit setup
13
  st.set_page_config(page_title="Sentiment Analysis on Your Cantonese Song",)
14
  st.header("Cantonese Song Sentiment Analyzer")
15
- #input_file = st.file_uploader("upload a song in mp3 format", type="mp3") # upload song
16
- #if input_file is not None:
17
- #st.write("File uploaded successfully!")
18
- #st.write(input_file)
19
- #else:
20
- #st.write("No file uploaded.")
21
  button_click = st.button("Run Analysis", type="primary")
22
 
23
  # load song
24
- input_file = os.path.isfile("test1.mp3")
25
  output_file = os.path.isdir("")
26
 
27
  # preprocess and crop audio file
@@ -36,13 +36,13 @@ def audio_preprocess():
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"
 
12
  # steamlit setup
13
  st.set_page_config(page_title="Sentiment Analysis on Your Cantonese Song",)
14
  st.header("Cantonese Song Sentiment Analyzer")
15
+ input_file = st.file_uploader("upload a song in mp3 format", type="mp3") # upload song
16
+ if input_file is not None:
17
+ st.write("File uploaded successfully!")
18
+ st.write(input_file)
19
+ else:
20
+ st.write("No file uploaded.")
21
  button_click = st.button("Run Analysis", type="primary")
22
 
23
  # load song
24
+ #input_file = os.path.isfile("test1.mp3")
25
  output_file = os.path.isdir("")
26
 
27
  # preprocess and crop audio file
 
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"