Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,26 @@
|
|
1 |
import gradio as gr
|
2 |
from TTS.api import TTS
|
|
|
|
|
|
|
3 |
|
|
|
|
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
def try1():
|
6 |
model_name1 = TTS.list_models()
|
7 |
print (f"model1 Name: {model_name1}")
|
@@ -31,7 +50,7 @@ with gr.Blocks() as app:
|
|
31 |
btn1 = gr.Button()
|
32 |
btn2 = gr.Button()
|
33 |
|
34 |
-
btn1.click(
|
35 |
#btn2.click(try2,None,out1)
|
36 |
|
37 |
app.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from TTS.api import TTS
|
3 |
+
from bark import SAMPLE_RATE, generate_audio, preload_models
|
4 |
+
from scipy.io.wavfile import write as write_wav
|
5 |
+
from IPython.display import Audio
|
6 |
|
7 |
+
# download and load all models
|
8 |
+
preload_models()
|
9 |
|
10 |
+
def bark_try():
|
11 |
+
# generate audio from text
|
12 |
+
text_prompt = """
|
13 |
+
Hello, my name is Suno. And, uh — and I like pizza. [laughs]
|
14 |
+
But I also have other interests such as playing tic tac toe.
|
15 |
+
"""
|
16 |
+
audio_array = generate_audio(text_prompt)
|
17 |
+
|
18 |
+
# save audio to disk
|
19 |
+
write_wav("bark_generation.wav", SAMPLE_RATE, audio_array)
|
20 |
+
|
21 |
+
# play text in notebook
|
22 |
+
#Audio(audio_array, rate=SAMPLE_RATE)
|
23 |
+
return ("bark_generation.wav")
|
24 |
def try1():
|
25 |
model_name1 = TTS.list_models()
|
26 |
print (f"model1 Name: {model_name1}")
|
|
|
50 |
btn1 = gr.Button()
|
51 |
btn2 = gr.Button()
|
52 |
|
53 |
+
btn1.click(bark_try,None,out1)
|
54 |
#btn2.click(try2,None,out1)
|
55 |
|
56 |
app.launch()
|