Spaces:
Running on Zero
Running on Zero
Commit ·
928bb51
1
Parent(s): 95b67fb
output -> result in process function to fix local variable/global variable conflict
Browse files
app.py
CHANGED
|
@@ -85,15 +85,15 @@ def process_fn(
|
|
| 85 |
if sig.dim() == 2:
|
| 86 |
sig = sig.unsqueeze(0)
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
|
| 91 |
# Remove batch dimension
|
| 92 |
-
|
| 93 |
|
| 94 |
output_audio_path = os.path.join("src", "_outputs", "output_restored.wav")
|
| 95 |
os.makedirs(os.path.dirname(output_audio_path), exist_ok=True)
|
| 96 |
-
torchaudio.save(output_audio_path,
|
| 97 |
print(f"✓ Saved output to {output_audio_path}")
|
| 98 |
|
| 99 |
return output_audio_path
|
|
|
|
| 85 |
if sig.dim() == 2:
|
| 86 |
sig = sig.unsqueeze(0)
|
| 87 |
|
| 88 |
+
with torch.inference_mode():
|
| 89 |
+
result = model(sig)
|
| 90 |
|
| 91 |
# Remove batch dimension
|
| 92 |
+
result = result.squeeze(0)
|
| 93 |
|
| 94 |
output_audio_path = os.path.join("src", "_outputs", "output_restored.wav")
|
| 95 |
os.makedirs(os.path.dirname(output_audio_path), exist_ok=True)
|
| 96 |
+
torchaudio.save(output_audio_path, result.cpu(), 44100)
|
| 97 |
print(f"✓ Saved output to {output_audio_path}")
|
| 98 |
|
| 99 |
return output_audio_path
|