text-to-speech / tool.py
davidxia's picture
Change to use text_to_speech
0811999 verified
raw
history blame contribute delete
405 Bytes
from smolagents import Tool
from huggingface_hub import InferenceClient
class TextToSpeechTool(Tool):
description = "This tool synthesizes speech from text."
name = "speech_generator"
inputs = {"text": {"type": "string", "description": "The text input"}}
output_type = "audio"
client = InferenceClient()
def forward(self, text):
return self.client.text_to_speech(text)