Update app.py
Browse files
app.py
CHANGED
@@ -90,13 +90,13 @@ def stream_decode_audio(encoded_file_path) -> Generator[tuple, None, None]:
|
|
90 |
for i in range(0, z.shape[2], chunk_size):
|
91 |
z_chunk = z[:, :, i:i+chunk_size]
|
92 |
audio_chunk = agc.decode(z_chunk)
|
93 |
-
# Convert to numpy
|
94 |
-
audio_data = audio_chunk.squeeze(0).cpu().numpy().T
|
95 |
yield (sample_rate, audio_data)
|
96 |
|
97 |
except Exception as e:
|
98 |
print(f"Streaming decoding error: {e}")
|
99 |
-
yield (sample_rate,
|
100 |
|
101 |
# Gradio Interface
|
102 |
with gr.Blocks() as demo:
|
|
|
90 |
for i in range(0, z.shape[2], chunk_size):
|
91 |
z_chunk = z[:, :, i:i+chunk_size]
|
92 |
audio_chunk = agc.decode(z_chunk)
|
93 |
+
# Convert to numpy array and transpose
|
94 |
+
audio_data = audio_chunk.squeeze(0).cpu().numpy().T
|
95 |
yield (sample_rate, audio_data)
|
96 |
|
97 |
except Exception as e:
|
98 |
print(f"Streaming decoding error: {e}")
|
99 |
+
yield (sample_rate, np.zeros((2, chunk_size), dtype=np.float32)) # Return silence in case of error
|
100 |
|
101 |
# Gradio Interface
|
102 |
with gr.Blocks() as demo:
|