Spaces:
Runtime error
Runtime error
xuesongyan
commited on
Commit
·
7699d3a
1
Parent(s):
7b1e83b
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import gradio as gr
|
|
| 4 |
|
| 5 |
def function(audio_path, output_dir="example/output"):
|
| 6 |
filename = os.path.basename(audio_path).split('.')[0]
|
| 7 |
-
|
| 8 |
cmd_result = os.popen(f'python spleeter separate -p spleeter:2stems -o {output_dir} {audio_path}').read()
|
| 9 |
print(cmd_result)
|
| 10 |
return f"example/output/{filename}/accompaniment.wav", f"example/output/{filename}/vocals.wav"
|
|
@@ -12,12 +12,16 @@ def function(audio_path, output_dir="example/output"):
|
|
| 12 |
inputs = [
|
| 13 |
gr.inputs.Audio(source="upload", type="filepath", label=None, optional=False)
|
| 14 |
]
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
examples = ["example/audio_example.mp3"]
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
iface.launch(share=True)
|
| 21 |
|
| 22 |
if __name__ == "__main__":
|
| 23 |
-
|
|
|
|
| 4 |
|
| 5 |
def function(audio_path, output_dir="example/output"):
|
| 6 |
filename = os.path.basename(audio_path).split('.')[0]
|
| 7 |
+
|
| 8 |
cmd_result = os.popen(f'python spleeter separate -p spleeter:2stems -o {output_dir} {audio_path}').read()
|
| 9 |
print(cmd_result)
|
| 10 |
return f"example/output/{filename}/accompaniment.wav", f"example/output/{filename}/vocals.wav"
|
|
|
|
| 12 |
inputs = [
|
| 13 |
gr.inputs.Audio(source="upload", type="filepath", label=None, optional=False)
|
| 14 |
]
|
| 15 |
+
outputs = [
|
| 16 |
+
gr.outputs.Audio(type="file", label='accompaniment'),
|
| 17 |
+
gr.outputs.Audio(type="file", label='vocals')
|
| 18 |
+
]
|
| 19 |
|
| 20 |
examples = ["example/audio_example.mp3"]
|
| 21 |
|
| 22 |
+
|
| 23 |
+
iface = gr.Interface(fn=function, inputs=inputs, outputs=outputs, examples=examples)
|
| 24 |
iface.launch(share=True)
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|
| 27 |
+
pass
|