Spaces:
Build error
Build error
Update app.py (#3)
Browse files- Update app.py (b88a4665f7a7bf14d1e0c877b4afbd089c3924ef)
app.py
CHANGED
|
@@ -472,6 +472,17 @@ def check_btn(btn):
|
|
| 472 |
def transcribe():
|
| 473 |
return 'Success'
|
| 474 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
|
| 476 |
|
| 477 |
demo = gr.Blocks(css=".markdown-body { font-size: 18px; }")
|
|
@@ -526,26 +537,18 @@ with demo:
|
|
| 526 |
# When an audio file is selected, it will display the file path
|
| 527 |
audio_file_dropdown.change(fn=load_audio_file, inputs=[audio_file_dropdown], outputs=[audio_output])
|
| 528 |
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
called evaluation keys, enables a server to work on the encrypted data without seeing the
|
| 538 |
-
actual data.
|
| 539 |
-
"""
|
| 540 |
)
|
|
|
|
|
|
|
| 541 |
|
| 542 |
-
gen_key_btn = gr.Button("Generate the secret and evaluation keys")
|
| 543 |
-
|
| 544 |
-
gen_key_btn.click(
|
| 545 |
-
key_gen_fn,
|
| 546 |
-
inputs=[],
|
| 547 |
-
outputs=[gen_key_btn],
|
| 548 |
-
)
|
| 549 |
|
| 550 |
########################## Step 1.1: Record Audio ##########################
|
| 551 |
|
|
@@ -580,6 +583,36 @@ with demo:
|
|
| 580 |
|
| 581 |
clear.click(lambda: None, None, msg, queue=False)
|
| 582 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 583 |
########################## Main document Part ##########################
|
| 584 |
|
| 585 |
gr.Markdown("<hr />")
|
|
|
|
| 472 |
def transcribe():
|
| 473 |
return 'Success'
|
| 474 |
|
| 475 |
+
def transcribe_audio(audio_path):
|
| 476 |
+
# Prétraitement de l'audio
|
| 477 |
+
audio = preprocess_audio(audio_path)
|
| 478 |
+
|
| 479 |
+
# Chargement du modèle
|
| 480 |
+
model = load_model()
|
| 481 |
+
|
| 482 |
+
# Transcription
|
| 483 |
+
transcription = model.transcribe(audio)
|
| 484 |
+
|
| 485 |
+
return transcription
|
| 486 |
|
| 487 |
|
| 488 |
demo = gr.Blocks(css=".markdown-body { font-size: 18px; }")
|
|
|
|
| 537 |
# When an audio file is selected, it will display the file path
|
| 538 |
audio_file_dropdown.change(fn=load_audio_file, inputs=[audio_file_dropdown], outputs=[audio_output])
|
| 539 |
|
| 540 |
+
with gr.Row():
|
| 541 |
+
transcribe_btn = gr.Button("Transcrire l'audio")
|
| 542 |
+
transcription_output = gr.Textbox(label="Transcription", lines=5)
|
| 543 |
|
| 544 |
+
transcribe_btn.click(
|
| 545 |
+
fn=transcribe_audio,
|
| 546 |
+
inputs=[audio_output],
|
| 547 |
+
outputs=[transcription_output]
|
|
|
|
|
|
|
|
|
|
| 548 |
)
|
| 549 |
+
|
| 550 |
+
|
| 551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 552 |
|
| 553 |
########################## Step 1.1: Record Audio ##########################
|
| 554 |
|
|
|
|
| 583 |
|
| 584 |
clear.click(lambda: None, None, msg, queue=False)
|
| 585 |
|
| 586 |
+
########################## Transcription ##########################
|
| 587 |
+
with gr.Row():
|
| 588 |
+
transcribe_btn = gr.Button("Transcrire l'audio")
|
| 589 |
+
transcription_output = gr.Textbox(label="Transcription", lines=5)
|
| 590 |
+
|
| 591 |
+
transcribe_btn.click(
|
| 592 |
+
fn=transcribe_audio,
|
| 593 |
+
inputs=[audio_output],
|
| 594 |
+
outputs=[transcription_output]
|
| 595 |
+
)
|
| 596 |
+
|
| 597 |
+
########################## Key Gen Part ##########################
|
| 598 |
+
|
| 599 |
+
gr.Markdown(
|
| 600 |
+
"## Step 1.2: Generate the keys\n\n"
|
| 601 |
+
"""In Fully Homomorphic Encryption (FHE) methods, two types of keys are created. The first
|
| 602 |
+
type, called secret keys, are used to encrypt and decrypt the user's data. The second type,
|
| 603 |
+
called evaluation keys, enables a server to work on the encrypted data without seeing the
|
| 604 |
+
actual data.
|
| 605 |
+
"""
|
| 606 |
+
)
|
| 607 |
+
|
| 608 |
+
gen_key_btn = gr.Button("Generate the secret and evaluation keys")
|
| 609 |
+
|
| 610 |
+
gen_key_btn.click(
|
| 611 |
+
key_gen_fn,
|
| 612 |
+
inputs=[],
|
| 613 |
+
outputs=[gen_key_btn],
|
| 614 |
+
)
|
| 615 |
+
|
| 616 |
########################## Main document Part ##########################
|
| 617 |
|
| 618 |
gr.Markdown("<hr />")
|