Update app.py
Browse files
app.py
CHANGED
@@ -2,15 +2,11 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import shutil
|
4 |
|
5 |
-
|
6 |
from huggingface_hub import snapshot_download
|
7 |
import numpy as np
|
8 |
from scipy.io import wavfile
|
9 |
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
model_ids = [
|
15 |
'suno/bark',
|
16 |
]
|
@@ -18,8 +14,6 @@ for model_id in model_ids:
|
|
18 |
model_name = model_id.split('/')[-1]
|
19 |
snapshot_download(model_id, local_dir=f'checkpoints/{model_name}')
|
20 |
|
21 |
-
|
22 |
-
|
23 |
from TTS.tts.configs.bark_config import BarkConfig
|
24 |
from TTS.tts.models.bark import Bark
|
25 |
|
@@ -48,7 +42,7 @@ def infer(prompt, input_wav_file):
|
|
48 |
shutil.move(source_path, os.path.join(destination_path, f"{file_name}.wav"))
|
49 |
|
50 |
|
51 |
-
text =
|
52 |
|
53 |
# with random speaker
|
54 |
#output_dict = model.synthesize(text, config, speaker_id="random", voice_dirs=None)
|
@@ -65,4 +59,11 @@ def infer(prompt, input_wav_file):
|
|
65 |
|
66 |
return "output.wav"
|
67 |
|
68 |
-
gr.Interface(fn=infer,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import os
|
3 |
import shutil
|
4 |
|
|
|
5 |
from huggingface_hub import snapshot_download
|
6 |
import numpy as np
|
7 |
from scipy.io import wavfile
|
8 |
|
9 |
|
|
|
|
|
|
|
10 |
model_ids = [
|
11 |
'suno/bark',
|
12 |
]
|
|
|
14 |
model_name = model_id.split('/')[-1]
|
15 |
snapshot_download(model_id, local_dir=f'checkpoints/{model_name}')
|
16 |
|
|
|
|
|
17 |
from TTS.tts.configs.bark_config import BarkConfig
|
18 |
from TTS.tts.models.bark import Bark
|
19 |
|
|
|
42 |
shutil.move(source_path, os.path.join(destination_path, f"{file_name}.wav"))
|
43 |
|
44 |
|
45 |
+
text = prompt
|
46 |
|
47 |
# with random speaker
|
48 |
#output_dict = model.synthesize(text, config, speaker_id="random", voice_dirs=None)
|
|
|
59 |
|
60 |
return "output.wav"
|
61 |
|
62 |
+
gr.Interface(fn=infer,
|
63 |
+
inputs=[gr.Textbox(label="Text to speech prompt"),
|
64 |
+
gr.Audio(
|
65 |
+
label="WAV voice to clone",
|
66 |
+
type="filepath",
|
67 |
+
source="upload")],
|
68 |
+
outputs=[gr.Audio()],
|
69 |
+
title="Instant Voice Cloning").launch()
|