File size: 931 Bytes
09c51d6
b357930
 
 
 
f9f533a
b357930
 
 
 
 
 
f9f533a
b357930
 
f9f533a
b357930
 
bd76599
b357930
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from transformers import AutoProcessor, AutoModelForTextToWaveform
# Load the processor and model
processor = AutoProcessor.from_pretrained("suno/bark-small")
model = AutoModelForTextToWaveform.from_pretrained("suno/bark-small")

# Define a function to process input and generate waveform
def generate_waveform(text):
    inputs = processor(text, return_tensors="pt", padding=True, truncation=True)
    with torch.no_grad():
        output = model(**inputs)
    return output

# Input text
input_text = 'Prolongation'

# Generate waveform
waveform_output = generate_waveform(input_text)

# Display waveform
gr.Interface(
    generate_waveform, 
    inputs=gr.inputs.Textbox(default=input_text, label="Enter your text here"),
    outputs=gr.outputs.Audio(type="audio", label="Generated Audio"),
    title="Text to Waveform Generation",
    description="Enter text and generate corresponding waveform"
).launch()