jone commited on
Commit
4927f1c
1 Parent(s): 799b3c1
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -14,8 +14,15 @@ os.system('chmod a+x ./scripts/*/*.sh')
14
  os.system('./separate_scripts/download_checkpoints.sh')
15
 
16
  def inference(audio):
 
 
 
 
 
 
 
17
  # read the file and get the sample rate and data
18
- rate, data = wavfile.read(audio.name)
19
 
20
  # save the result
21
  wavfile.write('foo_left.wav', rate, data)
 
14
  os.system('./separate_scripts/download_checkpoints.sh')
15
 
16
  def inference(audio):
17
+ input_path = audio.name
18
+
19
+ if input_path.endswith(".mp3"):
20
+ output_path = os.path.splitext(input_path)[0] + ".wav"
21
+ os.system(f"ffmpeg -y -loglevel panic -i {input_path} {output_path}")
22
+ input_path = output_path
23
+
24
  # read the file and get the sample rate and data
25
+ rate, data = wavfile.read(input_path)
26
 
27
  # save the result
28
  wavfile.write('foo_left.wav', rate, data)