Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,9 +7,13 @@ import scipy
|
|
| 7 |
processor = AutoProcessor.from_pretrained("suno/bark-small")
|
| 8 |
model = AutoModel.from_pretrained("suno/bark-small")
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
return_tensors="pt",
|
| 14 |
)
|
| 15 |
|
|
@@ -21,9 +25,10 @@ def run_bark():
|
|
| 21 |
return ("bark_out.wav")
|
| 22 |
|
| 23 |
with gr.Blocks() as app:
|
|
|
|
| 24 |
out_audio = gr.Audio()
|
| 25 |
go_btn = gr.Button()
|
| 26 |
|
| 27 |
-
go_btn.click(run_bark,
|
| 28 |
|
| 29 |
app.launch()
|
|
|
|
| 7 |
processor = AutoProcessor.from_pretrained("suno/bark-small")
|
| 8 |
model = AutoModel.from_pretrained("suno/bark-small")
|
| 9 |
|
| 10 |
+
|
| 11 |
+
def run_bark(text, lang="en", n=1):
|
| 12 |
+
history_prompt=f"{lang}_speaker_{n}"
|
| 13 |
+
|
| 14 |
+
#text=["Hello, my name is Suno. And, uh — and I like pizza. [laughs] But I also have other interests such as playing tic tac toe."],
|
| 15 |
+
inputs = processor(text=text,
|
| 16 |
+
history_prompt=history_prompt,
|
| 17 |
return_tensors="pt",
|
| 18 |
)
|
| 19 |
|
|
|
|
| 25 |
return ("bark_out.wav")
|
| 26 |
|
| 27 |
with gr.Blocks() as app:
|
| 28 |
+
in_text = gr.Textbox()
|
| 29 |
out_audio = gr.Audio()
|
| 30 |
go_btn = gr.Button()
|
| 31 |
|
| 32 |
+
go_btn.click(run_bark,in_text,out_audio)
|
| 33 |
|
| 34 |
app.launch()
|