Spaces:
Runtime error
Runtime error
import gradio as gr | |
from IPython.display import Audio | |
from transformers import pipeline | |
pipe = pipeline("text-to-speech", model="suno/bark-small") | |
def text_to_speech(text): | |
output = pipe(text) | |
print(output) # Debug print | |
if len(output) > 0 and "audio" in output[0] and "sampling_rate" in output[0]: | |
audio = Audio(output[0]["audio"], rate=output[0]["sampling_rate"]) | |
return audio | |
else: | |
return None | |
iface = gr.Interface( | |
fn=text_to_speech, | |
inputs="text", | |
outputs="audio", | |
title="Text-to-Speech", | |
description="Convert text to speech using Hugging Face's TTS model", | |
examples=[ | |
["Hello, how are you?"], | |
["Could you please repeat that?"], | |
["This is a test."], | |
], | |
article="https://huggingface.co/models", | |
) | |
iface.launch() |