Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
arpabet durations
Browse files- gr_client.py +17 -5
gr_client.py
CHANGED
@@ -114,12 +114,24 @@ def predict(
|
|
114 |
deepmoji_checked, # bool
|
115 |
api_name="/predict"
|
116 |
)
|
|
|
117 |
json_data = json.loads(response)
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
return [
|
121 |
wav_path,
|
122 |
-
|
123 |
round(json_data['em_angry'][0], 2),
|
124 |
round(json_data['em_happy'][0], 2),
|
125 |
round(json_data['em_sad'][0], 2),
|
@@ -212,7 +224,7 @@ language_radio = gr.Radio(
|
|
212 |
info="Will be more monotone and have an English accent. Tested mostly by a native Briton."
|
213 |
)
|
214 |
|
215 |
-
with gr.Blocks() as demo:
|
216 |
gr.Markdown("# xVASynth TTS")
|
217 |
|
218 |
with gr.Row(): # Main row for inputs and language selection
|
@@ -248,7 +260,7 @@ with gr.Blocks() as demo:
|
|
248 |
with gr.Column(): # Input column
|
249 |
happy_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ Happiness", info="Tread lightly beyond 0.7")
|
250 |
surprise_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ฎ Surprise", info="Can oversaturate Happiness")
|
251 |
-
deepmoji_checkbox = gr.Checkbox(label="Use DeepMoji", info="Auto adjust emotional values")
|
252 |
|
253 |
# Event handling using click
|
254 |
btn = gr.Button("Generate")
|
@@ -257,7 +269,7 @@ with gr.Blocks() as demo:
|
|
257 |
with gr.Column(): # Input column
|
258 |
output_wav = gr.Audio(label="22kHz audio output", type="filepath", editable=False)
|
259 |
with gr.Column(): # Input column
|
260 |
-
output_arpabet = gr.
|
261 |
|
262 |
btn.click(
|
263 |
fn=predict,
|
|
|
114 |
deepmoji_checked, # bool
|
115 |
api_name="/predict"
|
116 |
)
|
117 |
+
|
118 |
json_data = json.loads(response)
|
119 |
+
|
120 |
+
arpabet_html = '<h6>ARPAbet & Durations</h6>'
|
121 |
+
arpabet_symbols = json_data['arpabet'].split('|')
|
122 |
+
for symb_i in range(len(json_data['durations'])):
|
123 |
+
if (arpabet_symbols[symb_i] == '<PAD>'):
|
124 |
+
continue
|
125 |
+
|
126 |
+
arpabet_html += '<strong class="arpabet" style="padding: 0 '\
|
127 |
+
+ str(round(float(json_data['durations'][symb_i]/2), 1))\
|
128 |
+
+'em">'\
|
129 |
+
+ arpabet_symbols[symb_i]\
|
130 |
+
+ '</strong> '
|
131 |
|
132 |
return [
|
133 |
wav_path,
|
134 |
+
arpabet_html,
|
135 |
round(json_data['em_angry'][0], 2),
|
136 |
round(json_data['em_happy'][0], 2),
|
137 |
round(json_data['em_sad'][0], 2),
|
|
|
224 |
info="Will be more monotone and have an English accent. Tested mostly by a native Briton."
|
225 |
)
|
226 |
|
227 |
+
with gr.Blocks(css=".arpabet {display: inline-block; background-color: gray; border-radius: 5px; font-size: 120%; margin: 0.1em 0}") as demo:
|
228 |
gr.Markdown("# xVASynth TTS")
|
229 |
|
230 |
with gr.Row(): # Main row for inputs and language selection
|
|
|
260 |
with gr.Column(): # Input column
|
261 |
happy_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ Happiness", info="Tread lightly beyond 0.7")
|
262 |
surprise_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ฎ Surprise", info="Can oversaturate Happiness")
|
263 |
+
deepmoji_checkbox = gr.Checkbox(label="Use DeepMoji", info="Auto adjust emotional values", value=True)
|
264 |
|
265 |
# Event handling using click
|
266 |
btn = gr.Button("Generate")
|
|
|
269 |
with gr.Column(): # Input column
|
270 |
output_wav = gr.Audio(label="22kHz audio output", type="filepath", editable=False)
|
271 |
with gr.Column(): # Input column
|
272 |
+
output_arpabet = gr.HTML(label="ARPAbet")
|
273 |
|
274 |
btn.click(
|
275 |
fn=predict,
|