Spaces:
Running
Running
import gradio as gr | |
def letter_counter(word: str, letter: str) -> int: | |
""" | |
Count the occurrences of a specific letter in a word. | |
Args: | |
word (str): The word to count the letter in. | |
letter (str): The letter to count in the word. | |
Returns: | |
str: The number of occurrences of the letter in the word. | |
""" | |
return word.lower().count(letter.lower()) | |
demo = gr.Interface( | |
fn=letter_counter, | |
inputs=["text", "text"], | |
outputs="number", | |
title="Letter Counter", | |
description="Count the occurrences of a specific letter in a word.", | |
) | |
demo.launch(mcp_server=True) | |