Ahsen Khaliq commited on
Commit
d341a19
1 Parent(s): 0a5fc1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,13 +1,15 @@
1
  import gradio as gr
2
  import os
3
  from pathlib import Path
 
4
 
5
 
6
  def inference(audio):
7
  os.makedirs("out", exist_ok=True)
8
- oldext = os.path.splitext(audio)[1]
9
- os.rename(audio.name, "audio" + oldext)
10
- os.system("python3 -m demucs.separate -n demucs48_hq -d cpu " +"audio"+oldtext+" -o out")
 
11
  #audioname = Path(audio.name).stem
12
  return "./out/demucs48_hq/audio/vocals.wav"
13
 
@@ -17,7 +19,7 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2104.057
17
 
18
  gr.Interface(
19
  inference,
20
- [gr.inputs.Audio(type="file", label="Input")],
21
  gr.outputs.Audio(type="file", label="Output"),
22
  title=title,
23
  description=description,
 
1
  import gradio as gr
2
  import os
3
  from pathlib import Path
4
+ from scipy.io.wavfile import write
5
 
6
 
7
  def inference(audio):
8
  os.makedirs("out", exist_ok=True)
9
+ #oldext = os.path.splitext(audio)[1]
10
+ #os.rename(audio.name, "audio" + oldext)
11
+ write('test.wav', 44100, audio)
12
+ os.system("python3 -m demucs.separate -n demucs48_hq -d cpu test.wav -o out")
13
  #audioname = Path(audio.name).stem
14
  return "./out/demucs48_hq/audio/vocals.wav"
15
 
 
19
 
20
  gr.Interface(
21
  inference,
22
+ [gr.inputs.Audio(type="numpy", label="Input")],
23
  gr.outputs.Audio(type="file", label="Output"),
24
  title=title,
25
  description=description,