Spaces:
Running
on
Zero
Running
on
Zero
Remove static text from labels in TTS demo and update label formatting
Browse files
app.py
CHANGED
@@ -234,19 +234,19 @@ with gr.Blocks(title="Kokoro TTS Demo", css="""
|
|
234 |
tokens = count_tokens(initial_text)
|
235 |
time_estimate = math.ceil(tokens / lab_tps)
|
236 |
output_estimate = (time_estimate * lab_rts)//60
|
237 |
-
initial_label = f'<div class="token-label"
|
238 |
else:
|
239 |
-
initial_label = '<div class="token-label"
|
240 |
else:
|
241 |
-
initial_label = '<div class="token-label"
|
242 |
|
243 |
def update_text_label(text):
|
244 |
if not text:
|
245 |
-
return '<div class="token-label"
|
246 |
tokens = count_tokens(text)
|
247 |
time_estimate = math.ceil(tokens / lab_tps)
|
248 |
output_estimate = (time_estimate * lab_rts)//60
|
249 |
-
return f'<div class="token-label"
|
250 |
|
251 |
|
252 |
text_input = gr.TextArea(
|
@@ -262,7 +262,7 @@ with gr.Blocks(title="Kokoro TTS Demo", css="""
|
|
262 |
label_html = gr.HTML(initial_label)
|
263 |
|
264 |
def clear_text():
|
265 |
-
return "", '<div class="token-label"
|
266 |
|
267 |
clear_btn.click(
|
268 |
fn=clear_text,
|
|
|
234 |
tokens = count_tokens(initial_text)
|
235 |
time_estimate = math.ceil(tokens / lab_tps)
|
236 |
output_estimate = (time_estimate * lab_rts)//60
|
237 |
+
initial_label = f'<div class="token-label"><span class="token-count">Estimated {output_estimate} minutes in ~{time_estimate}s</span></div>'
|
238 |
else:
|
239 |
+
initial_label = '<div class="token-label"></div>'
|
240 |
else:
|
241 |
+
initial_label = '<div class="token-label"></div>'
|
242 |
|
243 |
def update_text_label(text):
|
244 |
if not text:
|
245 |
+
return '<div class="token-label"></div>'
|
246 |
tokens = count_tokens(text)
|
247 |
time_estimate = math.ceil(tokens / lab_tps)
|
248 |
output_estimate = (time_estimate * lab_rts)//60
|
249 |
+
return f'<div class="token-label"><span class="token-count">Estimated {output_estimate} minutes in ~{time_estimate}s</span></div>'
|
250 |
|
251 |
|
252 |
text_input = gr.TextArea(
|
|
|
262 |
label_html = gr.HTML(initial_label)
|
263 |
|
264 |
def clear_text():
|
265 |
+
return "", '<div class="token-label"></div>'
|
266 |
|
267 |
clear_btn.click(
|
268 |
fn=clear_text,
|