priyamarwaha commited on
Commit
e77bc8f
·
verified ·
1 Parent(s): f24b220

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +29 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def letter_counter(word: str, letter: str) -> int:
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 through
9
+ letter (str): The letter to search for
10
+
11
+ Returns:
12
+ int: The number of times the letter appears in the text
13
+ """
14
+ word = word.lower()
15
+ letter = letter.lower()
16
+ return word.count(letter)
17
+
18
+ demo = gr.Interface(
19
+ fn=letter_counter,
20
+ inputs=["text", "text"],
21
+ outputs=["text"],
22
+ title="Letter Counter",
23
+ description="Count the number of occurrences of a letter in a word or text.",
24
+ examples=[
25
+ ],
26
+ )
27
+
28
+ if __name__ == "__main__":
29
+ demo.launch(mcp_server=True)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio[mcp]