Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def configure_model(file_model, file_index):
|
|
27 |
consonant_breath_protection=0.5,
|
28 |
resample_sr=44100
|
29 |
)
|
30 |
-
return "Model configured successfully."
|
31 |
|
32 |
# Function to process each audio chunk
|
33 |
def transform_audio_chunk(audio, instream):
|
@@ -59,8 +59,8 @@ with gr.Blocks() as demo:
|
|
59 |
index_file = gr.Dropdown(choices=index_files, label="Select Index File")
|
60 |
configure_button = gr.Button("Configure Model")
|
61 |
|
62 |
-
# Audio input component with streaming enabled
|
63 |
-
inp = gr.Audio(
|
64 |
# Audio output component to play back the transformed audio
|
65 |
out = gr.Audio(streaming=True)
|
66 |
# State to manage the ongoing audio stream
|
@@ -70,7 +70,7 @@ with gr.Blocks() as demo:
|
|
70 |
inp.stream(transform_audio_chunk, [inp, stream], [out, stream])
|
71 |
|
72 |
# Link the model configuration button to the configure_model function
|
73 |
-
configure_button.click(configure_model, inputs=[model_file, index_file], outputs=[])
|
74 |
|
75 |
if __name__ == "__main__":
|
76 |
demo.launch()
|
|
|
27 |
consonant_breath_protection=0.5,
|
28 |
resample_sr=44100
|
29 |
)
|
30 |
+
return "Model configured successfully.", gr.update(visible=True)
|
31 |
|
32 |
# Function to process each audio chunk
|
33 |
def transform_audio_chunk(audio, instream):
|
|
|
59 |
index_file = gr.Dropdown(choices=index_files, label="Select Index File")
|
60 |
configure_button = gr.Button("Configure Model")
|
61 |
|
62 |
+
# Audio input component with streaming enabled, initially hidden
|
63 |
+
inp = gr.Audio(source="microphone", streaming=True, type="numpy", visible=False)
|
64 |
# Audio output component to play back the transformed audio
|
65 |
out = gr.Audio(streaming=True)
|
66 |
# State to manage the ongoing audio stream
|
|
|
70 |
inp.stream(transform_audio_chunk, [inp, stream], [out, stream])
|
71 |
|
72 |
# Link the model configuration button to the configure_model function
|
73 |
+
configure_button.click(configure_model, inputs=[model_file, index_file], outputs=[None, inp])
|
74 |
|
75 |
if __name__ == "__main__":
|
76 |
demo.launch()
|