RexChan commited on
Commit
28356eb
·
verified ·
1 Parent(s): 9854ac0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -17
app.py CHANGED
@@ -10,22 +10,6 @@ import os
10
  import accelerate
11
 
12
 
13
- # steamlit setup
14
- st.set_page_config(page_title="Sentiment Analysis on Your Cantonese Song",)
15
- st.header("Cantonese Song Sentiment Analyzer")
16
- input_file = st.file_uploader("upload a song in mp3 format", type="mp3") # upload song
17
- if input_file is not None:
18
- st.write("File uploaded successfully!")
19
- st.write(input_file)
20
- else:
21
- st.write("No file uploaded.")
22
- button_click = st.button("Run Analysis", type="primary")
23
-
24
-
25
- # load song
26
- #input_file = os.path.isfile("test1.mp3")
27
- output_file = os.path.isdir("")
28
-
29
 
30
  # preprocess and crop audio file
31
  def audio_preprocess(file_name = '/test1/vocals.wav'):
@@ -102,7 +86,10 @@ def senti_model(transcription):
102
  def main():
103
 
104
 
105
- processed_audio = audio_preprocess(input_file)
 
 
 
106
  transcription = asr_model(processed_audio)
107
  final_result = senti_model(transcription)
108
  st.write(final_result)
@@ -118,5 +105,24 @@ def main():
118
 
119
 
120
  if __name__ == '__main__':
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  if button_click:
122
  main()
 
10
  import accelerate
11
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # preprocess and crop audio file
15
  def audio_preprocess(file_name = '/test1/vocals.wav'):
 
86
  def main():
87
 
88
 
89
+ # processed_audio = audio_preprocess(input_file)
90
+ processed_audio = input_file
91
+
92
+
93
  transcription = asr_model(processed_audio)
94
  final_result = senti_model(transcription)
95
  st.write(final_result)
 
105
 
106
 
107
  if __name__ == '__main__':
108
+
109
+
110
+ # steamlit setup
111
+ st.set_page_config(page_title="Sentiment Analysis on Your Cantonese Song",)
112
+ st.header("Cantonese Song Sentiment Analyzer")
113
+ input_file = st.file_uploader("upload a song in mp3 format", type="mp3") # upload song
114
+ if input_file is not None:
115
+ st.write("File uploaded successfully!")
116
+ st.write(input_file)
117
+ else:
118
+ st.write("No file uploaded.")
119
+ button_click = st.button("Run Analysis", type="primary")
120
+
121
+
122
+ # load song
123
+ #input_file = os.path.isfile("test1.mp3")
124
+ output_file = os.path.isdir("")
125
+
126
+
127
  if button_click:
128
  main()