dylanebert commited on
Commit
e5000db
Β·
1 Parent(s): 93f66e7

add instructions

Browse files
Files changed (1) hide show
  1. app.py +38 -1
app.py CHANGED
@@ -206,8 +206,40 @@ def get_model_card(model_id: str) -> str:
206
  return f"Error: {e}"
207
 
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  search_models = gr.Interface(
210
  fn=search_models,
 
211
  inputs=[
212
  gr.Textbox(label="search", value=""),
213
  gr.Textbox(label="library", value=""),
@@ -221,6 +253,7 @@ search_models = gr.Interface(
221
 
222
  get_model_info = gr.Interface(
223
  fn=get_model_info,
 
224
  inputs=[
225
  gr.Textbox(label="model_id", value=""),
226
  ],
@@ -228,10 +261,14 @@ get_model_info = gr.Interface(
228
 
229
  get_model_card = gr.Interface(
230
  fn=get_model_card,
 
231
  inputs=[
232
  gr.Textbox(label="model_id", value=""),
233
  ],
234
  outputs="text")
235
 
236
- demo = gr.TabbedInterface([search_models, get_model_info, get_model_card], ["search_models", "get_model_info", "get_model_card"])
 
 
 
237
  demo.launch(mcp_server=True)
 
206
  return f"Error: {e}"
207
 
208
 
209
+ description_html = """
210
+ <h1>πŸ€— Hugging Face MCP Server</h1>
211
+ <p>Use AI Agents to interact with the Hugging Face Hub.</p>
212
+
213
+ <h3>Available tools:</h3>
214
+ <ul>
215
+ <li><strong>search_models</strong>: Find models by name, tags, etc.</li>
216
+ <li><strong>get_model_info</strong>: Get model metadata</li>
217
+ <li><strong>get_model_card</strong>: View model documentation</li>
218
+ </ul>
219
+
220
+ <h3>Setup (for Cursor):</h3>
221
+ <ol>
222
+ <li>Click <strong>"Use via API"</strong> β†’ <strong>"MCP"</strong> tab</li>
223
+ <li>Copy SSE config:
224
+ <pre>
225
+ {
226
+ "mcpServers": {
227
+ "gradio": {
228
+ "url": "https://dylanebert-huggingface-mcp.hf.space/gradio_api/mcp/sse"
229
+ }
230
+ }
231
+ }
232
+ </pre>
233
+ </li>
234
+ <li>Paste in: <strong>Cursor Settings</strong> β†’ <strong>MCP</strong> β†’ <strong>Add Global MCP Server</strong></li>
235
+ <li>Chat in agent mode with prompts like: "list top 10 trending models on Hugging Face"</li>
236
+ </ol>
237
+ <hr>
238
+ """
239
+
240
  search_models = gr.Interface(
241
  fn=search_models,
242
+ description=description_html,
243
  inputs=[
244
  gr.Textbox(label="search", value=""),
245
  gr.Textbox(label="library", value=""),
 
253
 
254
  get_model_info = gr.Interface(
255
  fn=get_model_info,
256
+ description=description_html,
257
  inputs=[
258
  gr.Textbox(label="model_id", value=""),
259
  ],
 
261
 
262
  get_model_card = gr.Interface(
263
  fn=get_model_card,
264
+ description=description_html,
265
  inputs=[
266
  gr.Textbox(label="model_id", value=""),
267
  ],
268
  outputs="text")
269
 
270
+ demo = gr.TabbedInterface(
271
+ interface_list=[search_models, get_model_info, get_model_card],
272
+ tab_names=["search_models", "get_model_info", "get_model_card"]
273
+ )
274
  demo.launch(mcp_server=True)