Spaces:
Runtime error
Runtime error
Konstantin Verner
commited on
Commit
•
1d92ccb
1
Parent(s):
54c283e
gradio app added
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
|
6 |
+
os.system('ffmpeg-normalize $sample -nt rms -t=-27 -o $sample -ar 16000 -f')
|
7 |
+
|
8 |
+
def greet(text, audio_file_path):
|
9 |
+
text = "%s" % text
|
10 |
+
audio_file_path = "%s" % audio_file_path
|
11 |
+
out_path = "scripts/output/audio.wav"
|
12 |
+
|
13 |
+
os.system(f'python scripts/train.py --audio_path {audio_file_path}\
|
14 |
+
--output_dir "models"')
|
15 |
+
os.system(f'python scripts/cloning_inference.py --model_path "models/microsoft_speecht5_tts_{audio_file_path[:-4]}"\
|
16 |
+
--input_text {text} --output_path {out_path}')
|
17 |
+
|
18 |
+
return out_path
|
19 |
+
|
20 |
+
|
21 |
+
demo = gr.Interface(
|
22 |
+
fn=greet,
|
23 |
+
inputs=[gr.inputs.Textbox(label='What would you like the voice to say? (max. 2000 characters per request)'),
|
24 |
+
gr.Audio(type="filepath", source="upload", label='Upload a voice to clone (max. 50mb)')],
|
25 |
+
outputs="audio",
|
26 |
+
title="Deep Voice Cloning Tool"
|
27 |
+
)
|
28 |
+
demo.launch()
|