File size: 405 Bytes
8ade5a8
f428b3b
 
 
0811999
 
 
 
 
 
f428b3b
 
0811999
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)