Spaces:
Sleeping
Sleeping
hello
Browse files
app.py
CHANGED
@@ -1,30 +1,25 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
Count the
|
6 |
|
7 |
Args:
|
8 |
-
word
|
9 |
-
letter
|
10 |
|
11 |
Returns:
|
12 |
-
|
13 |
"""
|
14 |
-
|
15 |
-
|
16 |
-
count = word.count(letter)
|
17 |
-
return count
|
18 |
|
19 |
-
# Create a standard Gradio interface
|
20 |
demo = gr.Interface(
|
21 |
fn=letter_counter,
|
22 |
-
inputs=["
|
23 |
outputs="number",
|
24 |
title="Letter Counter",
|
25 |
-
description="
|
26 |
)
|
27 |
|
28 |
-
|
29 |
-
if __name__ == "__main__":
|
30 |
-
demo.launch(mcp_server=True)
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
|
4 |
+
def letter_counter(word, letter):
|
5 |
+
"""Count the occurrences of a specific letter in a word.
|
6 |
|
7 |
Args:
|
8 |
+
word: The word or phrase to analyze
|
9 |
+
letter: The letter to count occurrences of
|
10 |
|
11 |
Returns:
|
12 |
+
The number of times the letter appears in the word
|
13 |
"""
|
14 |
+
return word.lower().count(letter.lower())
|
15 |
+
|
|
|
|
|
16 |
|
|
|
17 |
demo = gr.Interface(
|
18 |
fn=letter_counter,
|
19 |
+
inputs=["text", "text"],
|
20 |
outputs="number",
|
21 |
title="Letter Counter",
|
22 |
+
description="Count how many times a letter appears in a word"
|
23 |
)
|
24 |
|
25 |
+
demo.launch(mcp_server=True)
|
|
|
|