Spaces:
Sleeping
Sleeping
OthmaneLKH
commited on
Commit
•
798b3ec
1
Parent(s):
c34cba5
Update app.py
Browse files
app.py
CHANGED
@@ -431,6 +431,13 @@ def load_audio_file(selected_audio):
|
|
431 |
file_path = os.path.join(AUDIO_FOLDER_PATH, selected_audio)
|
432 |
return file_path
|
433 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
434 |
|
435 |
|
436 |
demo = gr.Blocks(css=".markdown-body { font-size: 18px; }")
|
@@ -484,6 +491,8 @@ with demo:
|
|
484 |
|
485 |
# When an audio file is selected, it will display the file path
|
486 |
audio_file_dropdown.change(fn=load_audio_file, inputs=[audio_file_dropdown], outputs=[audio_output])
|
|
|
|
|
487 |
|
488 |
########################## Key Gen Part ##########################
|
489 |
|
@@ -496,6 +505,17 @@ with demo:
|
|
496 |
"""
|
497 |
)
|
498 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
gen_key_btn = gr.Button("Generate the secret and evaluation keys")
|
500 |
|
501 |
gen_key_btn.click(
|
|
|
431 |
file_path = os.path.join(AUDIO_FOLDER_PATH, selected_audio)
|
432 |
return file_path
|
433 |
|
434 |
+
# Step 1.1: Record and save the audio file
|
435 |
+
def save_recorded_audio(audio):
|
436 |
+
file_path = os.path.join(AUDIO_FOLDER_PATH, "recorded_audio.wav")
|
437 |
+
audio.export(file_path, format="wav") # Save the audio as a .wav file
|
438 |
+
return file_path
|
439 |
+
|
440 |
+
|
441 |
|
442 |
|
443 |
demo = gr.Blocks(css=".markdown-body { font-size: 18px; }")
|
|
|
491 |
|
492 |
# When an audio file is selected, it will display the file path
|
493 |
audio_file_dropdown.change(fn=load_audio_file, inputs=[audio_file_dropdown], outputs=[audio_output])
|
494 |
+
|
495 |
+
|
496 |
|
497 |
########################## Key Gen Part ##########################
|
498 |
|
|
|
505 |
"""
|
506 |
)
|
507 |
|
508 |
+
########################## Step 1.1: Record Audio ##########################
|
509 |
+
|
510 |
+
gr.Markdown("## Step 1.1: Record an Audio File")
|
511 |
+
|
512 |
+
with gr.Row():
|
513 |
+
audio_recorder = gr.Audio(source="microphone", type="file", label="Record Audio")
|
514 |
+
record_output = gr.Audio(label="Recorded Audio", type="filepath")
|
515 |
+
|
516 |
+
# When the user records an audio, save it
|
517 |
+
audio_recorder.change(fn=save_recorded_audio, inputs=[audio_recorder], outputs=[record_output])
|
518 |
+
|
519 |
gen_key_btn = gr.Button("Generate the secret and evaluation keys")
|
520 |
|
521 |
gen_key_btn.click(
|