Spaces:
Runtime error
Runtime error
phil71x
commited on
Commit
·
3be532c
1
Parent(s):
9cfe71b
docs: Update server documentation to reflect renaming of server.py to app.py and modify setup instructions for PDM
Browse files- docs/01_mcp_server.md +12 -5
docs/01_mcp_server.md
CHANGED
@@ -25,9 +25,9 @@ The server is implemented in Python, a language well-suited for web development
|
|
25 |
### d. TextBlob (for the Example Tool)
|
26 |
[TextBlob](https://textblob.readthedocs.io/) is a Python library for text processing. We use it here to implement our example `sentiment_analysis` function. While TextBlob provides the logic for the tool, the focus is on how Gradio exposes *any such function* as an MCP tool.
|
27 |
|
28 |
-
## 3. Server Implementation (`
|
29 |
|
30 |
-
The `
|
31 |
|
32 |
```python
|
33 |
import gradio as gr
|
@@ -84,9 +84,16 @@ if __name__ == "__main__":
|
|
84 |
## 4. Running the Server
|
85 |
|
86 |
To start the server:
|
87 |
-
1. Ensure
|
88 |
-
2.
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
You should see output indicating:
|
92 |
* The local URL for the web interface (e.g., `http://127.0.0.1:7860`).
|
|
|
25 |
### d. TextBlob (for the Example Tool)
|
26 |
[TextBlob](https://textblob.readthedocs.io/) is a Python library for text processing. We use it here to implement our example `sentiment_analysis` function. While TextBlob provides the logic for the tool, the focus is on how Gradio exposes *any such function* as an MCP tool.
|
27 |
|
28 |
+
## 3. Server Implementation (`app.py`)
|
29 |
|
30 |
+
The `app.py` script contains all the logic for our server.
|
31 |
|
32 |
```python
|
33 |
import gradio as gr
|
|
|
84 |
## 4. Running the Server
|
85 |
|
86 |
To start the server:
|
87 |
+
1. Ensure you have [PDM](https://pdm.fming.dev/) installed in your environment.
|
88 |
+
2. Add the required dependencies using PDM:
|
89 |
+
```bash
|
90 |
+
pdm add gradio textblob
|
91 |
+
```
|
92 |
+
3. Save the code above as `app.py`.
|
93 |
+
4. Run the script using PDM:
|
94 |
+
```bash
|
95 |
+
pdm run python app.py
|
96 |
+
```
|
97 |
|
98 |
You should see output indicating:
|
99 |
* The local URL for the web interface (e.g., `http://127.0.0.1:7860`).
|