nakas commited on
Commit
3d2597d
1 Parent(s): 6075b90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -173,10 +173,16 @@ def predict_full(model, text, melody, duration, topk, topp, temperature, cfg_coe
173
  def inference(audio):
174
  print (audio)
175
  os.makedirs("out", exist_ok=True)
176
- write('test.wav', audio[0], audio[1])
177
-
178
  command = "python3 -m demucs.separate -n mdx_extra_q -d cpu test.wav -o out"
179
- process = sp.run(command, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
 
 
 
 
 
 
 
 
180
  print("Demucs script output:", process.stdout.decode())
181
 
182
  os.makedirs("out", exist_ok=True)
 
173
  def inference(audio):
174
  print (audio)
175
  os.makedirs("out", exist_ok=True)
 
 
176
  command = "python3 -m demucs.separate -n mdx_extra_q -d cpu test.wav -o out"
177
+
178
+
179
+ # Find the index of "test.wav" in the command
180
+ index = command.find("test.wav")
181
+
182
+ # Replace "test.wav" with the file path
183
+ new_command = command[:index] + audio + command[index + len("test.wav"):]
184
+
185
+ process = sp.run(new_command, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
186
  print("Demucs script output:", process.stdout.decode())
187
 
188
  os.makedirs("out", exist_ok=True)