fffiloni commited on
Commit
f523090
1 Parent(s): 8e00ffa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -3,6 +3,9 @@ import gradio as gr
3
 
4
 
5
  from huggingface_hub import snapshot_download
 
 
 
6
 
7
 
8
 
@@ -34,6 +37,12 @@ def infer(prompt):
34
  # It assumes that you have a speaker file in `bark_voices/speaker_n/speaker.wav` or `bark_voices/speaker_n/speaker.npz`
35
  output_dict = model.synthesize(text, config, speaker_id="speaker", voice_dirs="bark_voices/")
36
  print(output_dict)
37
- return "done"
38
 
39
- gr.Interface(fn=infer, inputs=[gr.Textbox()], outputs=[gr.Textbox()]).launch()
 
 
 
 
 
 
 
 
3
 
4
 
5
  from huggingface_hub import snapshot_download
6
+ import numpy as np
7
+ from scipy.io import wavfile
8
+
9
 
10
 
11
 
 
37
  # It assumes that you have a speaker file in `bark_voices/speaker_n/speaker.wav` or `bark_voices/speaker_n/speaker.npz`
38
  output_dict = model.synthesize(text, config, speaker_id="speaker", voice_dirs="bark_voices/")
39
  print(output_dict)
 
40
 
41
+ sample_rate = 44100 # Replace with the actual sample rate
42
+
43
+ wavfile.write('output.wav', sample_rate, output_dict['wav'])
44
+
45
+
46
+ return "output.wav"
47
+
48
+ gr.Interface(fn=infer, inputs=[gr.Textbox()], outputs=[gr.Audio()]).launch()