jhtonyKoo commited on
Commit
e6453cd
·
1 Parent(s): 2cce219

modify app

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -35,14 +35,15 @@ def process_audio(input_audio, reference_audio):
35
  # Denormalize the audio to int16
36
  output_audio = denormalize_audio(output_audio, dtype=np.int16)
37
 
38
- # Ensure the audio is in the correct shape (samples, channels)
39
  if output_audio.ndim == 1:
40
  output_audio = output_audio.reshape(-1, 1)
41
- elif output_audio.ndim == 2 and output_audio.shape[1] > output_audio.shape[0]:
42
- output_audio = output_audio.transpose(1,0)
43
  elif output_audio.ndim > 2:
44
  output_audio = output_audio.squeeze()
45
-
 
 
 
 
46
  print(output_audio.shape)
47
  print(param_output)
48
 
@@ -80,13 +81,14 @@ def perform_ito(input_audio, reference_audio, ito_reference_audio, num_steps, op
80
  # Denormalize the audio to int16
81
  current_output = denormalize_audio(current_output, dtype=np.int16)
82
 
 
 
 
 
 
83
  # Ensure the audio is in the correct shape (samples, channels)
84
- if current_output.ndim == 1:
85
- current_output = current_output.reshape(-1, 1)
86
- elif current_output.ndim == 2 and current_output.shape[1] > current_output.shape[0]:
87
- current_output = current_output.transpose(1,0)
88
- elif current_output.ndim > 2:
89
- current_output = current_output.squeeze()
90
 
91
  yield (args.sample_rate, current_output), ito_param_output, step, ito_log
92
 
 
35
  # Denormalize the audio to int16
36
  output_audio = denormalize_audio(output_audio, dtype=np.int16)
37
 
 
38
  if output_audio.ndim == 1:
39
  output_audio = output_audio.reshape(-1, 1)
 
 
40
  elif output_audio.ndim > 2:
41
  output_audio = output_audio.squeeze()
42
+
43
+ # Ensure the audio is in the correct shape (samples, channels)
44
+ if output_audio.shape[1] > output_audio.shape[0]:
45
+ output_audio = output_audio.transpose(1,0)
46
+
47
  print(output_audio.shape)
48
  print(param_output)
49
 
 
81
  # Denormalize the audio to int16
82
  current_output = denormalize_audio(current_output, dtype=np.int16)
83
 
84
+ if output_audio.ndim == 1:
85
+ output_audio = output_audio.reshape(-1, 1)
86
+ elif output_audio.ndim > 2:
87
+ output_audio = output_audio.squeeze()
88
+
89
  # Ensure the audio is in the correct shape (samples, channels)
90
+ if output_audio.shape[1] > output_audio.shape[0]:
91
+ output_audio = output_audio.transpose(1,0)
 
 
 
 
92
 
93
  yield (args.sample_rate, current_output), ito_param_output, step, ito_log
94