KwabsHug commited on
Commit
2bcfdc5
·
verified ·
1 Parent(s): 3e1d197

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
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() # this exposes the function as an MCP tool to ChatGPT
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=[transliteration_box, correct_nwfwo_box, user_guess_box, explanation_box],
 
 
 
 
 
122
  outputs=[result_box],
123
  )
124
 
@@ -216,11 +221,8 @@ def nwfwo_html_card():
216
  # ---- 5. Main entrypoint ----
217
 
218
  if __name__ == "__main__":
219
- # This launches:
220
- # - a browser-accessible Gradio UI for local testing
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
  )