musdfakoc commited on
Commit
819610c
·
verified ·
1 Parent(s): 6deab9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -178,15 +178,15 @@ def generate_audio_from_image(image):
178
  # Transpose to (samples, channels) for stereo
179
  generated_audio = generated_audio.T
180
 
181
- # Ensure that the audio is a 2D array (for stereo)
182
  if generated_audio.ndim == 1:
183
  generated_audio = np.expand_dims(generated_audio, axis=-1) # Add channel dimension for mono
184
 
185
  # Debug: Print the shape and type of the generated audio
186
  print(f"Generated audio shape after processing: {generated_audio.shape}, type: {generated_audio.dtype}")
187
 
188
- # Return the audio and the sample rate (ensure sample rate is an integer)
189
- return generated_audio, int(sample_rate)
190
 
191
 
192
 
 
178
  # Transpose to (samples, channels) for stereo
179
  generated_audio = generated_audio.T
180
 
181
+ # Ensure the audio is 2D (even if mono)
182
  if generated_audio.ndim == 1:
183
  generated_audio = np.expand_dims(generated_audio, axis=-1) # Add channel dimension for mono
184
 
185
  # Debug: Print the shape and type of the generated audio
186
  print(f"Generated audio shape after processing: {generated_audio.shape}, type: {generated_audio.dtype}")
187
 
188
+ # Explicit return of the tuple (audio_data, sample_rate)
189
+ return generated_audio, sample_rate
190
 
191
 
192