aishitdharwal commited on
Commit
b79c492
·
1 Parent(s): cd3586a
Files changed (1) hide show
  1. app.py +3 -12
app.py CHANGED
@@ -1,24 +1,15 @@
1
  import gradio as gr
2
- from transformers import pipeline, AutoProcessor
3
  import numpy as np
4
 
5
- # Initialize the model and processor
6
- processor = AutoProcessor.from_pretrained("suno/bark-small")
7
  pipe = pipeline(model="suno/bark-small")
8
 
9
  def text_to_speech(text):
10
- # Prepare the input with proper attention mask
11
- inputs = processor(
12
- text,
13
- return_tensors="pt",
14
- padding=True,
15
- return_attention_mask=True
16
- )
17
-
18
  # Generate audio from text
19
  output = pipe(
20
  text,
21
- attention_mask=inputs.attention_mask
22
  )
23
 
24
  # Normalize and scale audio to int16 range
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
  import numpy as np
4
 
5
+ # Initialize the model
 
6
  pipe = pipeline(model="suno/bark-small")
7
 
8
  def text_to_speech(text):
 
 
 
 
 
 
 
 
9
  # Generate audio from text
10
  output = pipe(
11
  text,
12
+ return_attention_mask=True
13
  )
14
 
15
  # Normalize and scale audio to int16 range