Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ class NWFWOExample:
|
|
| 24 |
|
| 25 |
# ---- 2. Core tool logic: check the learner’s guess ----
|
| 26 |
|
| 27 |
-
@gr.mcp.tool() #
|
| 28 |
def check_nwfwo(
|
| 29 |
transliteration: str,
|
| 30 |
correct_nwfwo: str,
|
|
@@ -118,7 +118,12 @@ with gr.Blocks() as demo:
|
|
| 118 |
|
| 119 |
btn.click(
|
| 120 |
local_check_ui,
|
| 121 |
-
inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
outputs=[result_box],
|
| 123 |
)
|
| 124 |
|
|
@@ -216,11 +221,8 @@ def nwfwo_html_card():
|
|
| 216 |
# ---- 5. Main entrypoint ----
|
| 217 |
|
| 218 |
if __name__ == "__main__":
|
| 219 |
-
#
|
| 220 |
-
#
|
| 221 |
-
# - an MCP server (on /mcp) for ChatGPT to connect to
|
| 222 |
demo.launch(
|
| 223 |
-
server_name="0.0.0.0",
|
| 224 |
-
server_port=7860,
|
| 225 |
mcp_server=True,
|
| 226 |
)
|
|
|
|
| 24 |
|
| 25 |
# ---- 2. Core tool logic: check the learner’s guess ----
|
| 26 |
|
| 27 |
+
@gr.mcp.tool() # exposes the function as an MCP tool to ChatGPT / MCP clients
|
| 28 |
def check_nwfwo(
|
| 29 |
transliteration: str,
|
| 30 |
correct_nwfwo: str,
|
|
|
|
| 118 |
|
| 119 |
btn.click(
|
| 120 |
local_check_ui,
|
| 121 |
+
inputs=[
|
| 122 |
+
transliteration_box,
|
| 123 |
+
correct_nwfwo_box,
|
| 124 |
+
user_guess_box,
|
| 125 |
+
explanation_box,
|
| 126 |
+
],
|
| 127 |
outputs=[result_box],
|
| 128 |
)
|
| 129 |
|
|
|
|
| 221 |
# ---- 5. Main entrypoint ----
|
| 222 |
|
| 223 |
if __name__ == "__main__":
|
| 224 |
+
# On Hugging Face Spaces, you don't need to set port/host manually.
|
| 225 |
+
# mcp_server=True exposes the MCP endpoint (on /gradio_api/mcp/ in Spaces).
|
|
|
|
| 226 |
demo.launch(
|
|
|
|
|
|
|
| 227 |
mcp_server=True,
|
| 228 |
)
|