Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gitignore +10 -0
- .python-version +1 -0
- README.md +2 -8
- main.py +27 -0
- pyproject.toml +7 -0
.gitignore
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Python-generated files
|
2 |
+
__pycache__/
|
3 |
+
*.py[oc]
|
4 |
+
build/
|
5 |
+
dist/
|
6 |
+
wheels/
|
7 |
+
*.egg-info
|
8 |
+
|
9 |
+
# Virtual environments
|
10 |
+
.venv
|
.python-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
3.9
|
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
|
4 |
-
colorFrom: gray
|
5 |
-
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.32.1
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: test_mcp_server
|
3 |
+
app_file: main.py
|
|
|
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 5.32.1
|
|
|
|
|
6 |
---
|
|
|
|
main.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
demo = gr.Interface(
|
17 |
+
fn = letter_counter,
|
18 |
+
inputs = [
|
19 |
+
"text",
|
20 |
+
"text"
|
21 |
+
],
|
22 |
+
outputs = "number",
|
23 |
+
title="Letter Counter",
|
24 |
+
description="Enter a word and a letter to count how many times the letter appears in the word.",
|
25 |
+
)
|
26 |
+
|
27 |
+
demo.launch(mcp_server=True)
|
pyproject.toml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
name = "learn-mcp"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = "Add your description here"
|
5 |
+
readme = "README.md"
|
6 |
+
requires-python = ">=3.9"
|
7 |
+
dependencies = []
|