|
|
import os |
|
|
import torch |
|
|
import gradio as gr |
|
|
from bark import generate_audio, preload_models |
|
|
from scipy.io.wavfile import write as write_wav |
|
|
|
|
|
|
|
|
preload_models() |
|
|
|
|
|
def generate(text): |
|
|
|
|
|
text = f"[clears throat]{text} [laughs creepily] [breathing heavily]" |
|
|
|
|
|
audio_array = generate_audio(text) |
|
|
out_path = "output.wav" |
|
|
write_wav(out_path, rate=24000, data=audio_array) |
|
|
return out_path |
|
|
|
|
|
demo = gr.Interface( |
|
|
fn=generate, |
|
|
inputs=gr.Textbox(label="💀 Type something cursed"), |
|
|
outputs=gr.Audio(type="filepath"), |
|
|
title="Bark Horror Voice Generator", |
|
|
description="👹 Type scary text. Get glitchy cursed voice. Powered by Bark AI." |
|
|
) |
|
|
|
|
|
demo.launch() |
|
|
|