Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,6 @@ def infer(prompt, input_wav_file):
|
|
40 |
# Move the WAV file to the new directory
|
41 |
shutil.move(source_path, os.path.join(destination_path, f"{file_name}.wav"))
|
42 |
|
43 |
-
|
44 |
text = prompt
|
45 |
|
46 |
# with random speaker
|
@@ -72,27 +71,49 @@ def infer(prompt, input_wav_file):
|
|
72 |
for item in contents:
|
73 |
print(item)
|
74 |
|
75 |
-
return "output.wav", f"bark_voices/{file_name}/{
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
label="Text to speech prompt"
|
82 |
-
)
|
83 |
-
|
|
|
84 |
label="WAV voice to clone",
|
85 |
type="filepath",
|
86 |
source="upload"
|
87 |
)
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
91 |
label="Text to speech output"
|
92 |
-
)
|
93 |
-
|
|
|
94 |
label=".npz file"
|
95 |
)
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
# Move the WAV file to the new directory
|
41 |
shutil.move(source_path, os.path.join(destination_path, f"{file_name}.wav"))
|
42 |
|
|
|
43 |
text = prompt
|
44 |
|
45 |
# with random speaker
|
|
|
71 |
for item in contents:
|
72 |
print(item)
|
73 |
|
74 |
+
return "output.wav", f"bark_voices/{file_name}/{contents[1]}"
|
75 |
+
|
76 |
+
css = """
|
77 |
+
#col-container {max-width: 780px; margin-left: auto; margin-right: auto;}
|
78 |
+
"""
|
79 |
+
|
80 |
+
with gr.Blocks(css=css) as demo:
|
81 |
+
with gr.Column(elem_id="col-container"):
|
82 |
+
|
83 |
+
gr.HTML("""
|
84 |
+
<h1>Instant Voice Cloning</h1>
|
85 |
+
""")
|
86 |
+
|
87 |
+
prompt = gr.Textbox(
|
88 |
label="Text to speech prompt"
|
89 |
+
)
|
90 |
+
|
91 |
+
audio_in = gr.Audio(
|
92 |
label="WAV voice to clone",
|
93 |
type="filepath",
|
94 |
source="upload"
|
95 |
)
|
96 |
+
|
97 |
+
submit_btn = gr.Button("Submit")
|
98 |
+
|
99 |
+
cloned_out = gr.Audio(
|
100 |
label="Text to speech output"
|
101 |
+
)
|
102 |
+
|
103 |
+
npz_file = gr.File(
|
104 |
label=".npz file"
|
105 |
)
|
106 |
+
|
107 |
+
submit_btn.click(
|
108 |
+
fn = infer,
|
109 |
+
inputs = [
|
110 |
+
prompt,
|
111 |
+
audio_in
|
112 |
+
],
|
113 |
+
outputs = [
|
114 |
+
cloned_out,
|
115 |
+
npz_file
|
116 |
+
]
|
117 |
+
)
|
118 |
+
|
119 |
+
demo.queue().launch()
|