Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -79,24 +79,6 @@ css = """
|
|
79 |
}
|
80 |
"""
|
81 |
|
82 |
-
download_audio_js = """
|
83 |
-
() =>{{
|
84 |
-
let root = document.querySelector("body > gradio-app");
|
85 |
-
if (root.shadowRoot != null)
|
86 |
-
root = root.shadowRoot;
|
87 |
-
let audio = root.querySelector("#{audio_id}").querySelector("audio");
|
88 |
-
if (audio == undefined)
|
89 |
-
return;
|
90 |
-
audio = audio.src;
|
91 |
-
let oA = document.createElement("a");
|
92 |
-
oA.download = Math.floor(Math.random()*100000000)+'.wav';
|
93 |
-
oA.href = audio;
|
94 |
-
document.body.appendChild(oA);
|
95 |
-
oA.click();
|
96 |
-
oA.remove();
|
97 |
-
}}
|
98 |
-
"""
|
99 |
-
|
100 |
|
101 |
if __name__ == '__main__':
|
102 |
models_tts = []
|
@@ -151,8 +133,6 @@ if __name__ == '__main__':
|
|
151 |
tts_submit = gr.Button("Generate", variant="primary")
|
152 |
tts_output1 = gr.Textbox(label="Output Message")
|
153 |
tts_output2 = gr.Audio(label="Output Audio")
|
154 |
-
download = gr.Button("Download Audio")
|
155 |
-
download.click(None, [], [], _js=download_audio_js.format(audio_id=f"tts-audio{i}"))
|
156 |
tts_submit.click(tts_fn, [tts_input1, tts_input2, tts_input3, phoneme_input],
|
157 |
[tts_output1, tts_output2])
|
158 |
to_phoneme_btn.click(to_phoneme_fn, [tts_input1], [tts_input1])
|
|
|
79 |
}
|
80 |
"""
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
if __name__ == '__main__':
|
84 |
models_tts = []
|
|
|
133 |
tts_submit = gr.Button("Generate", variant="primary")
|
134 |
tts_output1 = gr.Textbox(label="Output Message")
|
135 |
tts_output2 = gr.Audio(label="Output Audio")
|
|
|
|
|
136 |
tts_submit.click(tts_fn, [tts_input1, tts_input2, tts_input3, phoneme_input],
|
137 |
[tts_output1, tts_output2])
|
138 |
to_phoneme_btn.click(to_phoneme_fn, [tts_input1], [tts_input1])
|