word-counter-tool / word_counter.py
Chris4K's picture
Update word_counter.py
bdba3bf verified
raw
history blame contribute delete
No virus
330 Bytes
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)