File size: 527 Bytes
b44beb2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)