Spaces:
Sleeping
Sleeping
update
Browse files- .gitignore +0 -0
- Dockerfile +0 -12
- README.md +43 -4
- app.py +2 -1
.gitignore
ADDED
|
File without changes
|
Dockerfile
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
FROM python:3.10-slim
|
| 2 |
-
|
| 3 |
-
WORKDIR /app
|
| 4 |
-
|
| 5 |
-
COPY requirements.txt .
|
| 6 |
-
RUN pip install -r requirements.txt
|
| 7 |
-
|
| 8 |
-
COPY . .
|
| 9 |
-
|
| 10 |
-
# Hugging Face Space 必须监听 7860 端口
|
| 11 |
-
# 直接启动 Gradio 服务,内置所有功能
|
| 12 |
-
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -1,7 +1,46 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: purple
|
| 6 |
-
sdk:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: English Words Generator
|
| 3 |
+
emoji: 🧠
|
| 4 |
+
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 4.36.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
short_description: Generate 200 English words with streaming output and MCP tools
|
| 12 |
---
|
| 13 |
+
|
| 14 |
+
# 🧠 English Words Generator
|
| 15 |
+
|
| 16 |
+
A Gradio application that generates 200 English words with streaming output and MCP (Model Context Protocol) tools support.
|
| 17 |
+
|
| 18 |
+
## Features
|
| 19 |
+
|
| 20 |
+
- **Streaming Word Generation**: Real-time streaming of 200 English words
|
| 21 |
+
- **MCP Tools**: Two MCP tools for word generation
|
| 22 |
+
- `generate_words_mcp`: Returns all words at once
|
| 23 |
+
- `generate_words_mcp_stream`: Streams words in real-time
|
| 24 |
+
- **Interactive Chat Interface**: Chat with the AI to generate words
|
| 25 |
+
- **200 Common English Words**: Pre-defined list of frequently used English words
|
| 26 |
+
|
| 27 |
+
## Usage
|
| 28 |
+
|
| 29 |
+
1. Enter your query in the text box
|
| 30 |
+
2. Click "Send" or press Enter
|
| 31 |
+
3. Watch the words stream in real-time
|
| 32 |
+
4. Use MCP tools for programmatic access
|
| 33 |
+
|
| 34 |
+
## MCP Tools
|
| 35 |
+
|
| 36 |
+
The application exposes two MCP tools:
|
| 37 |
+
|
| 38 |
+
- **generate_words_mcp**: Generates and returns all 200 words
|
| 39 |
+
- **generate_words_mcp_stream**: Streams words one by one
|
| 40 |
+
|
| 41 |
+
## Technical Details
|
| 42 |
+
|
| 43 |
+
- Built with Gradio 4.36.0
|
| 44 |
+
- Supports MCP protocol for AI assistant integration
|
| 45 |
+
- Async streaming for real-time word generation
|
| 46 |
+
- Clean, modern UI with Soft theme
|
app.py
CHANGED
|
@@ -142,4 +142,5 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 142 |
demo.load(generate_words_mcp_stream, inputs=None, outputs=gr.Textbox(label="流式MCP结果", visible=False))
|
| 143 |
|
| 144 |
# 开启 MCP server
|
| 145 |
-
|
|
|
|
|
|
| 142 |
demo.load(generate_words_mcp_stream, inputs=None, outputs=gr.Textbox(label="流式MCP结果", visible=False))
|
| 143 |
|
| 144 |
# 开启 MCP server
|
| 145 |
+
if __name__ == "__main__":
|
| 146 |
+
demo.launch(mcp_server=True)
|