letters_mcp / app.py
leotrieu
Add application file
b44beb2
raw
history blame contribute delete
527 Bytes
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."""
return word.lower().count(letter.lower())
def word_reverser(word: str) -> str:
"""Reverse the input word."""
return word[::-1]
with gr.Blocks() as app:
gr.Interface(fn=letter_counter, inputs=["text", "text"], outputs="number")
gr.Interface(fn=word_reverser, inputs="text", outputs="text")
if __name__ == "__main__":
app.launch(mcp_server=True, share=True)