Spaces:
Sleeping
Sleeping
from transformers import AutoTokenizer | |
from transformers import Tool | |
class WordCounterTool(Tool): | |
name = "word_counter" | |
description = "This is a tool for counting word of an input." | |
inputs = ["text"] | |
outputs = ["text"] | |
def __call__(self, prompt: str): | |
words = str.split(" ") | |
return len(words) | |