CoolFace
Apppublic

abidlabs/mcpt

sourceHugging Faceupdated 1y agoView on Hugging Face
2likes
app.py30 linesDownload Raw Back to root
1import gradio as gr2 3def letter_counter(word, letter):4    """5    Count the number of occurrences of a letter in a word or text.6 7    Args:8        word (str): The input text to search through9        letter (str): The letter to search for10 11    Returns:12        str: A message indicating how many times the letter appears13    """14    word = word.lower()15    letter = letter.lower()16    count = word.count(letter)17    return count18 19# Create and launch the Gradio interface20demo = gr.Interface(21    fn=letter_counter,22    inputs=["textbox", "textbox"],23    outputs="number",24    title="Letter Counter",25    description="Enter text and a letter to count how many times the letter appears in the text."26)27 28if __name__ == "__main__":29    demo.launch(mcp_server=True, strict_cors=False)30