owiedotch commited on
Commit
e4056a5
1 Parent(s): 3226a34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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, then to list, and yield as tuple with sample rate
94
- audio_data = audio_chunk.squeeze(0).cpu().numpy().T.tolist()
95
  yield (sample_rate, audio_data)
96
 
97
  except Exception as e:
98
  print(f"Streaming decoding error: {e}")
99
- yield (sample_rate, [[0] * chunk_size, [0] * chunk_size]) # Return silence in case of error
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: