Spaces:
Build error
Build error
plan.md outlines goals for this hackathon
Browse files- app.py +10 -3
- hf-mcp-hackathon/app.py +37 -0
- hf-mcp-hackathon/plan.md +18 -0
app.py
CHANGED
@@ -1,7 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def greet(name):
|
4 |
-
return "Hello " + name + "
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def greet(name):
|
4 |
+
return "Hello " + name + "!"
|
5 |
|
6 |
+
iface = gr.Interface(
|
7 |
+
fn=greet,
|
8 |
+
inputs=gr.Textbox(label="Input"),
|
9 |
+
outputs=gr.Textbox(label="Output"),
|
10 |
+
mcp_server=True
|
11 |
+
)
|
12 |
+
|
13 |
+
if __name__ == "__main__":
|
14 |
+
iface.launch(server_name="0.0.0.0", server_port=7860)
|
hf-mcp-hackathon/app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def analyze_text(text: str) -> dict:
|
4 |
+
"""Analyze text and return various statistics.
|
5 |
+
|
6 |
+
Args:
|
7 |
+
text: The text to analyze
|
8 |
+
|
9 |
+
Returns:
|
10 |
+
A dictionary containing text statistics like word count, character count, etc.
|
11 |
+
"""
|
12 |
+
stats = {
|
13 |
+
"word_count": len(text.split()),
|
14 |
+
"character_count": len(text),
|
15 |
+
"line_count": len(text.splitlines()) or 1,
|
16 |
+
"uppercase_count": sum(1 for c in text if c.isupper()),
|
17 |
+
"lowercase_count": sum(1 for c in text if c.islower()),
|
18 |
+
"digit_count": sum(1 for c in text if c.isdigit())
|
19 |
+
}
|
20 |
+
return stats
|
21 |
+
|
22 |
+
# Create the Gradio interface
|
23 |
+
demo = gr.Interface(
|
24 |
+
fn=analyze_text,
|
25 |
+
inputs=gr.Textbox(label="Input Text", placeholder="Enter some text to analyze..."),
|
26 |
+
outputs=gr.JSON(label="Text Statistics"),
|
27 |
+
title="Text Analysis Tool",
|
28 |
+
description="A simple tool that provides various statistics about input text.",
|
29 |
+
examples=[
|
30 |
+
["Hello World! This is a test message 123."],
|
31 |
+
["The quick brown fox jumps over the lazy dog."]
|
32 |
+
]
|
33 |
+
)
|
34 |
+
|
35 |
+
if __name__ == "__main__":
|
36 |
+
# Launch with MCP server enabled
|
37 |
+
demo.launch(mcp_server=True)
|
hf-mcp-hackathon/plan.md
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- [x] Join the Agents-MCP-Hackathon organization on Hugging Face.
|
2 |
+
- [x] Complete the registration form before June 8 2025 11:59 PM UTC
|
3 |
+
- [x] (MCP track selected)Decide on one of three tracks: MCP Server/Tool, Custom Component, or Agentic Demo.
|
4 |
+
- [x] (https://huggingface.co/blog/gradio-mcp) Download or clone the relevant starter template (MCP server boilerplate, custom component template, or basic agent demo).
|
5 |
+
- [ ] Review the "Getting Started with MCP with Gradio" and "Gradio Component Development Guide" documentation.
|
6 |
+
- [ ] Set up a local development environment with Python, Gradio 5, and any required SDKs (OpenAI, Anthropic, etc.) using provided API credits.
|
7 |
+
- [ ] Implement the required features:
|
8 |
+
- [ ] For Track 1, build a Gradio app that functions as an MCP server and test with an MCP client.
|
9 |
+
- [ ] For Track 2, create a custom Gradio component, publish it with gradio cc publish, and verify functionality.
|
10 |
+
- [ ] For Track 3, develop a Gradio app showcasing agentic behavior or integrations.
|
11 |
+
- [ ] Create a Space in Hugging Face for your project.
|
12 |
+
- [ ] Populate the Space's README.md with the mandatory track tag (mcp-server-track, custom-component-track, or agent-demo-track).
|
13 |
+
- [ ] Record a demonstration video of your app or component in action; host it on YouTube or similar.
|
14 |
+
- [ ] Insert the link to the demonstration video in README.md.
|
15 |
+
- [ ] Push all code and documentation to your Space before June 8 2025 11:59 PM UTC.
|
16 |
+
- [ ] Verify that your Space runs properly online; confirm video link accessibility.
|
17 |
+
- [ ] Monitor Discord and office hours for troubleshooting; resolve any issues immediately.
|
18 |
+
- [ ] Submit the final Space entry; ensure compliance with hackathon policies and original work requirements.
|