Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -1,7 +1,14 @@
|
|
1 |
-
from
|
|
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
4 |
|
|
|
5 |
|
6 |
-
def read_root():
|
7 |
-
return {"Hello": "World!"}
|
|
|
1 |
+
from bark import SAMPLE_RATE, generate_audio, preload_models
|
2 |
+
from scipy.io.wavfile import write as write_wav
|
3 |
+
# download and load all models
|
4 |
+
preload_models()
|
5 |
|
6 |
+
# generate audio from text
|
7 |
+
text_prompt = """
|
8 |
+
Hello, my name is Suno. And, uh — and I like pizza. [laughs]
|
9 |
+
But I also have other interests such as playing tic tac toe.
|
10 |
+
"""
|
11 |
+
speech_array = generate_audio(text_prompt)
|
12 |
|
13 |
+
write_wav("/path/to/audio.wav", SAMPLE_RATE, audio_array)
|
14 |
|
|
|
|