Kvikontent commited on
Commit
88c0a73
·
1 Parent(s): 7c82343

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -6,8 +6,11 @@ pipe = pipeline("text-to-speech", model="suno/bark-small")
6
 
7
  def text_to_speech(text):
8
  output = pipe(text)
9
- audio = Audio(output[0]["audio"], rate=output[0]["sampling_rate"])
10
- return audio
 
 
 
11
 
12
  iface = gr.Interface(
13
  fn=text_to_speech,
 
6
 
7
  def text_to_speech(text):
8
  output = pipe(text)
9
+ if len(output) > 0 and "audio" in output[0] and "sampling_rate" in output[0]:
10
+ audio = Audio(output[0]["audio"], rate=output[0]["sampling_rate"])
11
+ return audio
12
+ else:
13
+ return None
14
 
15
  iface = gr.Interface(
16
  fn=text_to_speech,