rahgadda commited on
Commit
72c4624
1 Parent(s): 625518d

Initial Draft

Browse files
Files changed (1) hide show
  1. voice.py +5 -5
voice.py CHANGED
@@ -7,7 +7,7 @@ import scipy
7
  ############################
8
 
9
  # -- UI Variables
10
- ui_input_voice_preseter=gr.Dropdown(
11
  ["v2/en_speaker_0","v2/en_speaker_9"], label="Voice Presenter"
12
  )
13
  ui_input_filename=gr.Textbox(label="Input WAV Filename")
@@ -23,16 +23,16 @@ model = BarkModel.from_pretrained("suno/bark")
23
  ############################
24
 
25
  # -- On Click of Submit Button in UI
26
- def submit(voice_preseter, filename, input_text):
27
  print("Hello World")
28
 
29
- inputs = processor(input_text, voice_preset=voice_preseter)
30
  audio_array = model.generate(**inputs)
31
  audio_array = audio_array.cpu().numpy().squeeze()
32
  sample_rate = model.generation_config.sample_rate
33
  scipy.io.wavfile.write(filename, rate=sample_rate, data=audio_array)
34
 
35
- retun gr.Audio(source=[os.path.join(os.path.dirname(__file__),filename])
36
 
37
  ############################
38
  ###### Main Program ########
@@ -45,7 +45,7 @@ ui_input_filename = "Hello uh ... [clears throat], \
45
  def main():
46
  demo = gr.Interface(
47
  fn=submit,
48
- inputs=[ui_input_voice_preseter,ui_input_filename,ui_input_text],
49
  outputs=ui_output,
50
  allow_flagging="never"
51
  )
 
7
  ############################
8
 
9
  # -- UI Variables
10
+ ui_input_voice_presenter=gr.Dropdown(
11
  ["v2/en_speaker_0","v2/en_speaker_9"], label="Voice Presenter"
12
  )
13
  ui_input_filename=gr.Textbox(label="Input WAV Filename")
 
23
  ############################
24
 
25
  # -- On Click of Submit Button in UI
26
+ def submit(voice_presenter, filename, input_text):
27
  print("Hello World")
28
 
29
+ inputs = processor(input_text, voice_preset=voice_presenter)
30
  audio_array = model.generate(**inputs)
31
  audio_array = audio_array.cpu().numpy().squeeze()
32
  sample_rate = model.generation_config.sample_rate
33
  scipy.io.wavfile.write(filename, rate=sample_rate, data=audio_array)
34
 
35
+ return gr.Audio(source=[os.path.join(os.path.dirname(__file__),filename)])
36
 
37
  ############################
38
  ###### Main Program ########
 
45
  def main():
46
  demo = gr.Interface(
47
  fn=submit,
48
+ inputs=[ui_input_voice_presenter,ui_input_filename,ui_input_text],
49
  outputs=ui_output,
50
  allow_flagging="never"
51
  )