Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -138,35 +138,10 @@ if __name__ == '__main__':
|
|
| 138 |
tts_input2 = gr.Dropdown(label="Speaker", choices=speakers,
|
| 139 |
type="index", value=speakers[0])
|
| 140 |
tts_input3 = gr.Slider(label="Speed", value=1, minimum=0.1, maximum=2, step=0.1)
|
| 141 |
-
# with gr.Accordion(label="Advanced Options", open=False):
|
| 142 |
-
# phoneme_input = gr.Checkbox(value=False, label="Phoneme input")
|
| 143 |
-
# to_phoneme_btn = gr.Button("Covert text to phoneme")
|
| 144 |
-
# phoneme_list = gr.Dataset(label="Phoneme list", components=[tts_input1],
|
| 145 |
-
# samples=[[x] for x in symbols],
|
| 146 |
-
# elem_id=f"phoneme-list{i}")
|
| 147 |
-
# phoneme_list_json = gr.Json(value=symbols, visible=False)
|
| 148 |
tts_submit = gr.Button("Generate", variant="primary")
|
| 149 |
tts_output1 = gr.Textbox(label="Output Message")
|
| 150 |
tts_output2 = gr.Audio(label="Output Audio")
|
| 151 |
tts_submit.click(tts_fn, [tts_input1, tts_input2, tts_input3],
|
| 152 |
-
[tts_output1, tts_output2])
|
| 153 |
-
(i,phonemes) => {{
|
| 154 |
-
let root = document.querySelector("body > gradio-app");
|
| 155 |
-
if (root.shadowRoot != null)
|
| 156 |
-
root = root.shadowRoot;
|
| 157 |
-
let text_input = root.querySelector("#tts-input{i}").querySelector("textarea");
|
| 158 |
-
let startPos = text_input.selectionStart;
|
| 159 |
-
let endPos = text_input.selectionEnd;
|
| 160 |
-
let oldTxt = text_input.value;
|
| 161 |
-
let result = oldTxt.substring(0, startPos) + phonemes[i] + oldTxt.substring(endPos);
|
| 162 |
-
text_input.value = result;
|
| 163 |
-
let x = window.scrollX, y = window.scrollY;
|
| 164 |
-
text_input.focus();
|
| 165 |
-
text_input.selectionStart = startPos + phonemes[i].length;
|
| 166 |
-
text_input.selectionEnd = startPos + phonemes[i].length;
|
| 167 |
-
text_input.blur();
|
| 168 |
-
window.scrollTo(x, y);
|
| 169 |
-
return [];
|
| 170 |
-
}}"""
|
| 171 |
|
| 172 |
app.queue(concurrency_count=3).launch(show_api=False)
|
|
|
|
| 138 |
tts_input2 = gr.Dropdown(label="Speaker", choices=speakers,
|
| 139 |
type="index", value=speakers[0])
|
| 140 |
tts_input3 = gr.Slider(label="Speed", value=1, minimum=0.1, maximum=2, step=0.1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
tts_submit = gr.Button("Generate", variant="primary")
|
| 142 |
tts_output1 = gr.Textbox(label="Output Message")
|
| 143 |
tts_output2 = gr.Audio(label="Output Audio")
|
| 144 |
tts_submit.click(tts_fn, [tts_input1, tts_input2, tts_input3],
|
| 145 |
+
[tts_output1, tts_output2])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
app.queue(concurrency_count=3).launch(show_api=False)
|