bilal01 commited on
Commit
c3baab1
·
1 Parent(s): 1b1b6e5

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -4
main.py CHANGED
@@ -1,7 +1,14 @@
1
- from fastapi import FastAPI
 
 
 
2
 
3
- app = FastAPI()
 
 
 
 
 
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