Update app.py
Browse files
app.py
CHANGED
|
@@ -531,21 +531,9 @@ def search_avps(query: str, threshold: float = 50) -> str:
|
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
-
# ---
|
| 535 |
-
with
|
| 536 |
-
|
| 537 |
-
# Groupe invisible : composants nécessaires pour exposer search_avps comme outil MCP
|
| 538 |
-
with gr.Group(visible=False):
|
| 539 |
-
_mcp_query = gr.Textbox(label="Profil ou mots-clés")
|
| 540 |
-
_mcp_threshold = gr.Slider(minimum=0, maximum=100, value=50, step=5, label="Score minimum (%)")
|
| 541 |
-
_mcp_output = gr.Textbox(label="Résultats JSON")
|
| 542 |
-
_mcp_btn = gr.Button("Rechercher")
|
| 543 |
-
_mcp_btn.click(
|
| 544 |
-
fn=search_avps,
|
| 545 |
-
inputs=[_mcp_query, _mcp_threshold],
|
| 546 |
-
outputs=_mcp_output,
|
| 547 |
-
api_name="search_avps",
|
| 548 |
-
)
|
| 549 |
|
| 550 |
if __name__ == "__main__":
|
| 551 |
-
|
|
|
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
+
# --- Endpoint MCP search_avps via gr.api (pas de composants UI nécessaires) ---
|
| 535 |
+
with demo:
|
| 536 |
+
gr.api(search_avps, api_name="search_avps")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 537 |
|
| 538 |
if __name__ == "__main__":
|
| 539 |
+
demo.launch(mcp_server=True)
|