Spaces:
Paused
Paused
Amjad Hassoun
commited on
Commit
·
b4f3031
1
Parent(s):
9a1196d
Update app.py
Browse files
app.py
CHANGED
|
@@ -352,14 +352,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 352 |
with gr.Column(elem_id="col-container"):
|
| 353 |
|
| 354 |
gr.Markdown("""
|
| 355 |
-
<h1 style="text-align: center;">
|
| 356 |
-
<p style="text-align: center;">
|
| 357 |
-
Mimic any voice character in less than 2 minutes with this <a href="https://tts.readthedocs.io/en/dev/models/bark.html" target="_blank">Coqui TTS + Bark</a> demo ! <br />
|
| 358 |
-
Upload a clean 20 seconds WAV file of the vocal persona you want to mimic, <br />
|
| 359 |
-
type your text-to-speech prompt and hit submit ! <br />
|
| 360 |
-
</p>
|
| 361 |
-
[](https://huggingface.co/spaces/fffiloni/instant-TTS-Bark-cloning?duplicate=true)
|
| 362 |
-
|
| 363 |
""")
|
| 364 |
with gr.Row():
|
| 365 |
with gr.Column():
|
|
@@ -378,7 +371,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 378 |
source="upload",
|
| 379 |
interactive = False
|
| 380 |
)
|
| 381 |
-
clean_sample = gr.Checkbox(label="Clean sample ?", value=False)
|
| 382 |
hidden_audio_numpy = gr.Audio(type="numpy", visible=False)
|
| 383 |
submit_btn = gr.Button("Submit")
|
| 384 |
|
|
@@ -415,20 +407,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 415 |
|
| 416 |
audio_in.upload(fn=load_hidden, inputs=[audio_in], outputs=[hidden_audio_numpy], queue=False)
|
| 417 |
micro_in.stop_recording(fn=load_hidden_mic, inputs=[micro_in], outputs=[hidden_audio_numpy], queue=False)
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
with gr.Tab("Voices Characters"):
|
| 421 |
-
selected_state = gr.State()
|
| 422 |
-
gallery_in = gr.Gallery(
|
| 423 |
-
label="Character Gallery",
|
| 424 |
-
value=[(item["image"], item["title"]) for item in characters],
|
| 425 |
-
interactive = True,
|
| 426 |
-
allow_preview=False,
|
| 427 |
-
columns=3,
|
| 428 |
-
elem_id="gallery",
|
| 429 |
-
show_share_button=False
|
| 430 |
-
)
|
| 431 |
-
c_submit_btn = gr.Button("Submit")
|
| 432 |
|
| 433 |
|
| 434 |
with gr.Column():
|
|
@@ -450,34 +428,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 450 |
|
| 451 |
folder_path = gr.Textbox(visible=False)
|
| 452 |
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
character_name = gr.Textbox(
|
| 456 |
-
label="Character Name",
|
| 457 |
-
placeholder="Name that voice character",
|
| 458 |
-
elem_id = "character-name"
|
| 459 |
-
)
|
| 460 |
-
|
| 461 |
-
voice_description = gr.Textbox(
|
| 462 |
-
label="description",
|
| 463 |
-
placeholder="How would you describe that voice ? ",
|
| 464 |
-
elem_id = "voice-description"
|
| 465 |
-
)
|
| 466 |
|
| 467 |
-
with gr.Group(elem_id="share-btn-container", visible=False) as share_group:
|
| 468 |
-
community_icon = gr.HTML(community_icon_html)
|
| 469 |
-
loading_icon = gr.HTML(loading_icon_html)
|
| 470 |
-
share_button = gr.Button("Share with Community", elem_id="share-btn")
|
| 471 |
|
| 472 |
-
share_button.click(None, [], [], _js=share_js, queue=False)
|
| 473 |
-
|
| 474 |
-
gallery_in.select(
|
| 475 |
-
update_selection,
|
| 476 |
-
outputs=[character_name, selected_state],
|
| 477 |
-
queue=False,
|
| 478 |
-
show_progress=False,
|
| 479 |
-
)
|
| 480 |
-
|
| 481 |
audio_in.change(fn=wipe_npz_file, inputs=[folder_path], queue=False)
|
| 482 |
micro_in.clear(fn=wipe_npz_file, inputs=[folder_path], queue=False)
|
| 483 |
|
|
@@ -500,14 +452,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 500 |
inputs = [
|
| 501 |
prompt,
|
| 502 |
audio_in,
|
| 503 |
-
clean_sample,
|
| 504 |
hidden_audio_numpy
|
| 505 |
],
|
| 506 |
outputs = [
|
| 507 |
cloned_out,
|
| 508 |
video_out,
|
| 509 |
npz_file,
|
| 510 |
-
share_group,
|
| 511 |
folder_path
|
| 512 |
],
|
| 513 |
cache_examples = False
|
|
@@ -534,14 +484,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 534 |
inputs = [
|
| 535 |
prompt,
|
| 536 |
audio_in,
|
| 537 |
-
clean_sample,
|
| 538 |
hidden_audio_numpy
|
| 539 |
],
|
| 540 |
outputs = [
|
| 541 |
cloned_out,
|
| 542 |
video_out,
|
| 543 |
npz_file,
|
| 544 |
-
share_group,
|
| 545 |
folder_path
|
| 546 |
]
|
| 547 |
)
|
|
@@ -558,23 +506,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 558 |
cloned_out,
|
| 559 |
video_out,
|
| 560 |
npz_file,
|
| 561 |
-
share_group,
|
| 562 |
folder_path
|
| 563 |
]
|
| 564 |
)
|
| 565 |
|
| 566 |
-
c_submit_btn.click(
|
| 567 |
-
fn = infer_from_c,
|
| 568 |
-
inputs = [
|
| 569 |
-
prompt,
|
| 570 |
-
character_name
|
| 571 |
-
],
|
| 572 |
-
outputs = [
|
| 573 |
-
cloned_out,
|
| 574 |
-
video_out,
|
| 575 |
-
npz_file,
|
| 576 |
-
share_group
|
| 577 |
-
]
|
| 578 |
-
)
|
| 579 |
-
|
| 580 |
demo.queue(api_open=False, max_size=10).launch()
|
|
|
|
| 352 |
with gr.Column(elem_id="col-container"):
|
| 353 |
|
| 354 |
gr.Markdown("""
|
| 355 |
+
<h1 style="text-align: center;">Voice Cloning Demo</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
""")
|
| 357 |
with gr.Row():
|
| 358 |
with gr.Column():
|
|
|
|
| 371 |
source="upload",
|
| 372 |
interactive = False
|
| 373 |
)
|
|
|
|
| 374 |
hidden_audio_numpy = gr.Audio(type="numpy", visible=False)
|
| 375 |
submit_btn = gr.Button("Submit")
|
| 376 |
|
|
|
|
| 407 |
|
| 408 |
audio_in.upload(fn=load_hidden, inputs=[audio_in], outputs=[hidden_audio_numpy], queue=False)
|
| 409 |
micro_in.stop_recording(fn=load_hidden_mic, inputs=[micro_in], outputs=[hidden_audio_numpy], queue=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
|
| 411 |
|
| 412 |
with gr.Column():
|
|
|
|
| 428 |
|
| 429 |
folder_path = gr.Textbox(visible=False)
|
| 430 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 433 |
audio_in.change(fn=wipe_npz_file, inputs=[folder_path], queue=False)
|
| 434 |
micro_in.clear(fn=wipe_npz_file, inputs=[folder_path], queue=False)
|
| 435 |
|
|
|
|
| 452 |
inputs = [
|
| 453 |
prompt,
|
| 454 |
audio_in,
|
|
|
|
| 455 |
hidden_audio_numpy
|
| 456 |
],
|
| 457 |
outputs = [
|
| 458 |
cloned_out,
|
| 459 |
video_out,
|
| 460 |
npz_file,
|
|
|
|
| 461 |
folder_path
|
| 462 |
],
|
| 463 |
cache_examples = False
|
|
|
|
| 484 |
inputs = [
|
| 485 |
prompt,
|
| 486 |
audio_in,
|
|
|
|
| 487 |
hidden_audio_numpy
|
| 488 |
],
|
| 489 |
outputs = [
|
| 490 |
cloned_out,
|
| 491 |
video_out,
|
| 492 |
npz_file,
|
|
|
|
| 493 |
folder_path
|
| 494 |
]
|
| 495 |
)
|
|
|
|
| 506 |
cloned_out,
|
| 507 |
video_out,
|
| 508 |
npz_file,
|
|
|
|
| 509 |
folder_path
|
| 510 |
]
|
| 511 |
)
|
| 512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
demo.queue(api_open=False, max_size=10).launch()
|