Spaces:
Build error
Build error
fix performance log
Browse files
app.py
CHANGED
|
@@ -42,9 +42,9 @@ def run_conversion(audio_in):
|
|
| 42 |
source = torch.mean(source, dim=0).unsqueeze(0)
|
| 43 |
source = source.unsqueeze(0)
|
| 44 |
|
| 45 |
-
time_start = time.perf_counter()
|
| 46 |
-
|
| 47 |
with torch.inference_mode():
|
|
|
|
|
|
|
| 48 |
# Extract speech units
|
| 49 |
units = hubert.units(source)
|
| 50 |
# Generate target spectrogram
|
|
@@ -54,12 +54,13 @@ def run_conversion(audio_in):
|
|
| 54 |
|
| 55 |
result = target.squeeze().cpu().multiply(32767).to(torch.int16).numpy()
|
| 56 |
|
| 57 |
-
|
|
|
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
|
| 65 |
with gr.Blocks() as demo:
|
|
|
|
| 42 |
source = torch.mean(source, dim=0).unsqueeze(0)
|
| 43 |
source = source.unsqueeze(0)
|
| 44 |
|
|
|
|
|
|
|
| 45 |
with torch.inference_mode():
|
| 46 |
+
time_start = time.perf_counter()
|
| 47 |
+
|
| 48 |
# Extract speech units
|
| 49 |
units = hubert.units(source)
|
| 50 |
# Generate target spectrogram
|
|
|
|
| 54 |
|
| 55 |
result = target.squeeze().cpu().multiply(32767).to(torch.int16).numpy()
|
| 56 |
|
| 57 |
+
time_end = time.perf_counter()
|
| 58 |
+
time_elapsed = time_end - time_start
|
| 59 |
|
| 60 |
+
print(f"Conversion finished in {time_elapsed} Seconds")
|
| 61 |
+
|
| 62 |
+
return (16000, result)
|
| 63 |
+
|
| 64 |
|
| 65 |
|
| 66 |
with gr.Blocks() as demo:
|