nakas commited on
Commit
89e329e
1 Parent(s): 3d2597d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -186,22 +186,26 @@ def inference(audio):
186
  print("Demucs script output:", process.stdout.decode())
187
 
188
  os.makedirs("out", exist_ok=True)
189
- write('test.wav', audio[0], audio[1])
190
- result = os.system("python3 -m demucs.separate -n mdx_extra_q -d cpu test.wav -o out")
191
  print(f"Demucs script result: {result}")
 
192
 
193
- # Check if files exist before returning
194
- files = ["./out/mdx_extra_q/test/vocals.wav",
195
- "./out/mdx_extra_q/test/bass.wav",
196
- "./out/mdx_extra_q/test/drums.wav",
197
- "./out/mdx_extra_q/test/other.wav"]
198
- for file in files:
 
 
 
 
199
  if not os.path.isfile(file):
200
  print(f"File not found: {file}")
201
  else:
202
  print(f"File exists: {file}")
203
 
204
- return files
205
 
206
 
207
  def toggle_audio_src(choice):
 
186
  print("Demucs script output:", process.stdout.decode())
187
 
188
  os.makedirs("out", exist_ok=True)
189
+ result = os.system(new_command)
 
190
  print(f"Demucs script result: {result}")
191
+ common_dir = os.path.dirname(audio)
192
 
193
+ files = [
194
+ "./out/mdx_extra_q/test/vocals.wav",
195
+ "./out/mdx_extra_q/test/bass.wav",
196
+ "./out/mdx_extra_q/test/drums.wav",
197
+ "./out/mdx_extra_q/test/other.wav"
198
+ ]
199
+
200
+ modified_files = [os.path.join(common_dir, os.path.basename(file)) for file in files]
201
+
202
+ for file in modified_files:
203
  if not os.path.isfile(file):
204
  print(f"File not found: {file}")
205
  else:
206
  print(f"File exists: {file}")
207
 
208
+ return modified_files
209
 
210
 
211
  def toggle_audio_src(choice):