Spaces:
Sleeping
Sleeping
leotrieu
commited on
Commit
·
b44beb2
1
Parent(s):
e537c3a
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def letter_counter(word: str, letter: str) -> int:
|
4 |
+
"""Count the number of occurrences of a letter in a word or text."""
|
5 |
+
return word.lower().count(letter.lower())
|
6 |
+
|
7 |
+
def word_reverser(word: str) -> str:
|
8 |
+
"""Reverse the input word."""
|
9 |
+
return word[::-1]
|
10 |
+
|
11 |
+
with gr.Blocks() as app:
|
12 |
+
gr.Interface(fn=letter_counter, inputs=["text", "text"], outputs="number")
|
13 |
+
gr.Interface(fn=word_reverser, inputs="text", outputs="text")
|
14 |
+
|
15 |
+
if __name__ == "__main__":
|
16 |
+
app.launch(mcp_server=True, share=True)
|