Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,10 +62,12 @@ def process_audio_stream(audio, instream):
|
|
62 |
# Append the processed output to instream for continuous processing
|
63 |
instream = torch.cat((instream, output))
|
64 |
|
65 |
-
|
|
|
66 |
else:
|
67 |
return gr.update(), instream
|
68 |
|
|
|
69 |
# Function to save audio to file
|
70 |
def save_audio(audio, audio_path, sample_rate):
|
71 |
torchaudio.save(audio_path, torch.tensor(audio, dtype=torch.float32), sample_rate)
|
|
|
62 |
# Append the processed output to instream for continuous processing
|
63 |
instream = torch.cat((instream, output))
|
64 |
|
65 |
+
# Convert the output to a numpy array and ensure it's returned as a tuple with the sample rate
|
66 |
+
return (instream.numpy(), sr), (instream.numpy(), sr)
|
67 |
else:
|
68 |
return gr.update(), instream
|
69 |
|
70 |
+
|
71 |
# Function to save audio to file
|
72 |
def save_audio(audio, audio_path, sample_rate):
|
73 |
torchaudio.save(audio_path, torch.tensor(audio, dtype=torch.float32), sample_rate)
|