Samuel L Meyers
commited on
Commit
·
fa52b2c
1
Parent(s):
7704fe6
Initial test with suno/bark-small
Browse files- .gitignore +1 -0
- app.py +18 -0
- packages.txt +0 -0
- requirements.txt +0 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
__pycache__*
|
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import AutoProcessor, AutoModel
|
| 3 |
+
import scipy
|
| 4 |
+
|
| 5 |
+
processor = AutoProcessor.from_pretrained("suno/bark-small")
|
| 6 |
+
model = AutoModel.from_pretrained("suno/bark-small")
|
| 7 |
+
|
| 8 |
+
def greet(text):
|
| 9 |
+
inputs = processor(
|
| 10 |
+
text=[text],
|
| 11 |
+
return_tensors="pt",
|
| 12 |
+
)
|
| 13 |
+
speech_values = model.generate(**inputs, do_sample=True)
|
| 14 |
+
scipy.io.wavfile.write("tmp.wav", rate=24000, data=speech_values.cpu().numpy().squeeze())
|
| 15 |
+
return open("tmp.wav", "rb").read()
|
| 16 |
+
|
| 17 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="audio")
|
| 18 |
+
iface.launch()
|
packages.txt
ADDED
|
File without changes
|
requirements.txt
ADDED
|
File without changes
|