jhtonyKoo commited on
Commit
1a135ff
·
1 Parent(s): 6d70884

modify app

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -14,6 +14,7 @@ def denormalize_audio(audio, dtype=np.int16):
14
  Denormalize the audio from the range [-1, 1] to the full range of the specified dtype.
15
  """
16
  if dtype == np.int16:
 
17
  return (audio * 32767).astype(np.int16)
18
  elif dtype == np.float32:
19
  return audio.astype(np.float32)
@@ -82,6 +83,8 @@ def perform_ito(input_audio, reference_audio, ito_reference_audio, num_steps, op
82
 
83
  yield (args.sample_rate, current_output), ito_param_output, step, ito_log
84
 
 
 
85
  with gr.Blocks() as demo:
86
  gr.Markdown("# Mastering Style Transfer Demo")
87
 
 
14
  Denormalize the audio from the range [-1, 1] to the full range of the specified dtype.
15
  """
16
  if dtype == np.int16:
17
+ audio = np.clip(audio, -1, 1) # Ensure the input is in the range [-1, 1]
18
  return (audio * 32767).astype(np.int16)
19
  elif dtype == np.float32:
20
  return audio.astype(np.float32)
 
83
 
84
  yield (args.sample_rate, current_output), ito_param_output, step, ito_log
85
 
86
+
87
+
88
  with gr.Blocks() as demo:
89
  gr.Markdown("# Mastering Style Transfer Demo")
90