nakas commited on
Commit
58f6009
1 Parent(s): 5599810

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +5 -3
utils.py CHANGED
@@ -10,7 +10,7 @@ import tensorflow as tf
10
  from tensorflow.python.framework import random_seed
11
  import gradio as gr
12
  from scipy.io.wavfile import write as write_wav
13
-
14
 
15
  class Utils_functions:
16
  def __init__(self, args):
@@ -620,10 +620,12 @@ class Utils_functions:
620
  ),
621
  -2,
622
  )
 
 
623
 
624
  return (
625
  np.clip(spec, -1.0, 1.0),
626
- (self.args.sr, np.int16(abwvc * 32767.0)),
627
  )
628
 
629
  def render_gradio(self, models_ls_1, models_ls_2, models_ls_3, train=True):
@@ -664,7 +666,7 @@ class Utils_functions:
664
  ],
665
  outputs=[
666
  gr.Image(label="Log-MelSpectrogram of Generated Audio (first 23 s)"),
667
- gr.Audio(type="numpy", label="Generated Audio"),
668
  ],
669
  title="musika!",
670
  description="Blazingly Fast 44.1 kHz Stereo Waveform Music Generation of Arbitrary Length. Be patient and enjoy the weirdness!",
 
10
  from tensorflow.python.framework import random_seed
11
  import gradio as gr
12
  from scipy.io.wavfile import write as write_wav
13
+ import soundfile as sf
14
 
15
  class Utils_functions:
16
  def __init__(self, args):
 
620
  ),
621
  -2,
622
  )
623
+ ##encode a wav file using scipy
624
+ # wav, sr = librosa.load("test.wav", sr=self.args.sr)
625
 
626
  return (
627
  np.clip(spec, -1.0, 1.0),
628
+ sf.write('newwav.wav', np.int16(abwvc * 32767.0, self.args.sr),
629
  )
630
 
631
  def render_gradio(self, models_ls_1, models_ls_2, models_ls_3, train=True):
 
666
  ],
667
  outputs=[
668
  gr.Image(label="Log-MelSpectrogram of Generated Audio (first 23 s)"),
669
+ gr.Audio(type="filepath", label="Generated Audio"),
670
  ],
671
  title="musika!",
672
  description="Blazingly Fast 44.1 kHz Stereo Waveform Music Generation of Arbitrary Length. Be patient and enjoy the weirdness!",