File size: 716 Bytes
e77bc8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr

def letter_counter(word: str, letter: str) -> int:
    """
    Count the number of occurrences of a letter in a word or text.

    Args:
        word (str): The input text to search through
        letter (str): The letter to search for

    Returns:
        int: The number of times the letter appears in the text
    """
    word = word.lower()
    letter = letter.lower()
    return word.count(letter)

demo = gr.Interface(
    fn=letter_counter,
    inputs=["text", "text"],
    outputs=["text"],
    title="Letter Counter",
    description="Count the number of occurrences of a letter in a word or text.",
    examples=[
    ],
)

if __name__ == "__main__":
    demo.launch(mcp_server=True)