Spaces:
Paused
Paused
Amjad Hassoun
commited on
Commit
Β·
60af96b
1
Parent(s):
7ea2058
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,26 +33,7 @@ script_choices = {
|
|
| 33 |
tts = TTS("tts_models/multilingual/multi-dataset/bark", gpu=True)
|
| 34 |
|
| 35 |
|
| 36 |
-
def
|
| 37 |
-
gr.Info("Cleaning your audio sample...")
|
| 38 |
-
os.makedirs("out", exist_ok=True)
|
| 39 |
-
write('test.wav', audio[0], audio[1])
|
| 40 |
-
os.system("python3 -m demucs.separate -n mdx_extra_q -j 4 test.wav -o out")
|
| 41 |
-
# return "./out/mdx_extra_q/test/vocals.wav","./out/mdx_extra_q/test/bass.wav","./out/mdx_extra_q/test/drums.wav","./out/mdx_extra_q/test/other.wav"
|
| 42 |
-
if chosen_out_track == "vocals":
|
| 43 |
-
print("Audio sample cleaned")
|
| 44 |
-
return "./out/mdx_extra_q/test/vocals.wav"
|
| 45 |
-
elif chosen_out_track == "bass":
|
| 46 |
-
return "./out/mdx_extra_q/test/bass.wav"
|
| 47 |
-
elif chosen_out_track == "drums":
|
| 48 |
-
return "./out/mdx_extra_q/test/drums.wav"
|
| 49 |
-
elif chosen_out_track == "other":
|
| 50 |
-
return "./out/mdx_extra_q/test/other.wav"
|
| 51 |
-
elif chosen_out_track == "all-in":
|
| 52 |
-
return "test.wav"
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
def infer(prompt, input_wav_file, clean_audio, hidden_numpy_audio, script_type):
|
| 56 |
print("""
|
| 57 |
βββββ
|
| 58 |
NEW INFERENCE:
|
|
@@ -60,21 +41,6 @@ NEW INFERENCE:
|
|
| 60 |
""")
|
| 61 |
if prompt == "":
|
| 62 |
gr.Warning("Do not forget to provide a tts prompt !")
|
| 63 |
-
|
| 64 |
-
if clean_audio is True:
|
| 65 |
-
print("We want to clean audio sample")
|
| 66 |
-
new_name = os.path.splitext(os.path.basename(input_wav_file))[0]
|
| 67 |
-
if os.path.exists(os.path.join("bark_voices", f"{new_name}_cleaned")):
|
| 68 |
-
print("This file has already been cleaned")
|
| 69 |
-
check_name = os.path.join("bark_voices", f"{new_name}_cleaned")
|
| 70 |
-
source_path = os.path.join(check_name, f"{new_name}_cleaned.wav")
|
| 71 |
-
else:
|
| 72 |
-
source_path = split_process(hidden_numpy_audio, "vocals")
|
| 73 |
-
|
| 74 |
-
new_path = os.path.join(os.path.dirname(
|
| 75 |
-
source_path), f"{new_name}_cleaned.wav")
|
| 76 |
-
os.rename(source_path, new_path)
|
| 77 |
-
source_path = new_path
|
| 78 |
else:
|
| 79 |
source_path = input_wav_file
|
| 80 |
|
|
@@ -237,8 +203,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 237 |
|
| 238 |
submit_btn.click(
|
| 239 |
fn=infer,
|
| 240 |
-
inputs=[script_text, micro_in,
|
| 241 |
-
hidden_audio_numpy, script_type_dropdown],
|
| 242 |
outputs=[cloned_out, video_out, npz_file, folder_path]
|
| 243 |
)
|
| 244 |
demo.queue(api_open=False, max_size=10).launch()
|
|
|
|
| 33 |
tts = TTS("tts_models/multilingual/multi-dataset/bark", gpu=True)
|
| 34 |
|
| 35 |
|
| 36 |
+
def infer(prompt, input_wav_file, script_type):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
print("""
|
| 38 |
βββββ
|
| 39 |
NEW INFERENCE:
|
|
|
|
| 41 |
""")
|
| 42 |
if prompt == "":
|
| 43 |
gr.Warning("Do not forget to provide a tts prompt !")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
else:
|
| 45 |
source_path = input_wav_file
|
| 46 |
|
|
|
|
| 203 |
|
| 204 |
submit_btn.click(
|
| 205 |
fn=infer,
|
| 206 |
+
inputs=[script_text, micro_in, script_type_dropdown],
|
|
|
|
| 207 |
outputs=[cloned_out, video_out, npz_file, folder_path]
|
| 208 |
)
|
| 209 |
demo.queue(api_open=False, max_size=10).launch()
|