File size: 330 Bytes
b4a8aea
e03f966
 
82863a2
 
bdba3bf
e03f966
 
 
bdba3bf
 
82863a2
b4a8aea
1
2
3
4
5
6
7
8
9
10
11
12
13
from transformers import AutoTokenizer
from transformers import Tool

class WordCounterTool(Tool):
    name = "word_counter"
    description = "This tool counts the words of a text."
    inputs = ["text"]
    outputs = ["text"]

    def __call__(self, text: str):
        words = text.split(" ")
        return len(words)