Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,11 @@ between: the reconstructed audio, the waveform comparison, the latent
|
|
| 7 |
representation itself, and the numbers behind the compression.
|
| 8 |
"""
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
import os
|
| 11 |
import time
|
| 12 |
import tempfile
|
|
@@ -145,6 +150,7 @@ def make_latent_figure(latent_matrix: np.ndarray):
|
|
| 145 |
# Core inference
|
| 146 |
# --------------------------------------------------------------------------
|
| 147 |
|
|
|
|
| 148 |
def process(audio_path, progress=gr.Progress(track_tqdm=False)):
|
| 149 |
if audio_path is None:
|
| 150 |
raise gr.Error("Upload or record a clip first.")
|
|
@@ -295,7 +301,7 @@ CUSTOM_CSS = f"""
|
|
| 295 |
}}
|
| 296 |
"""
|
| 297 |
|
| 298 |
-
with gr.Blocks(
|
| 299 |
gr.Markdown(
|
| 300 |
"# BlueCodec\n"
|
| 301 |
"Upload a voice clip and pass it through a 24-dimensional latent "
|
|
@@ -356,4 +362,4 @@ with gr.Blocks(css=CUSTOM_CSS, title="BlueCodec — speech autoencoder", theme=g
|
|
| 356 |
)
|
| 357 |
|
| 358 |
if __name__ == "__main__":
|
| 359 |
-
demo.queue().launch()
|
|
|
|
| 7 |
representation itself, and the numbers behind the compression.
|
| 8 |
"""
|
| 9 |
|
| 10 |
+
# `spaces` must be imported before torch (or anything that touches CUDA) so
|
| 11 |
+
# its ZeroGPU shims are installed first. This Space runs on ZeroGPU hardware,
|
| 12 |
+
# which requires at least one @spaces.GPU-decorated function.
|
| 13 |
+
import spaces
|
| 14 |
+
|
| 15 |
import os
|
| 16 |
import time
|
| 17 |
import tempfile
|
|
|
|
| 150 |
# Core inference
|
| 151 |
# --------------------------------------------------------------------------
|
| 152 |
|
| 153 |
+
@spaces.GPU(duration=60)
|
| 154 |
def process(audio_path, progress=gr.Progress(track_tqdm=False)):
|
| 155 |
if audio_path is None:
|
| 156 |
raise gr.Error("Upload or record a clip first.")
|
|
|
|
| 301 |
}}
|
| 302 |
"""
|
| 303 |
|
| 304 |
+
with gr.Blocks(title="BlueCodec — speech autoencoder") as demo:
|
| 305 |
gr.Markdown(
|
| 306 |
"# BlueCodec\n"
|
| 307 |
"Upload a voice clip and pass it through a 24-dimensional latent "
|
|
|
|
| 362 |
)
|
| 363 |
|
| 364 |
if __name__ == "__main__":
|
| 365 |
+
demo.queue().launch(theme=gr.themes.Base(), css=CUSTOM_CSS)
|