Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def ma_fonction_mcp(entree: str) -> str:
|
| 4 |
+
"""
|
| 5 |
+
Exemple de fonction MCP : prend une entrée texte et retourne une réponse.
|
| 6 |
+
Args:
|
| 7 |
+
entree: Le texte d'entrée.
|
| 8 |
+
Returns:
|
| 9 |
+
Le texte de sortie.
|
| 10 |
+
"""
|
| 11 |
+
return f"Réponse MCP : {entree.upper()}"
|
| 12 |
+
|
| 13 |
+
# Création de l'interface Gradio avec support MCP
|
| 14 |
+
demo = gr.Interface(
|
| 15 |
+
fn=ma_fonction_mcp,
|
| 16 |
+
inputs=gr.Textbox(label="Entrée"),
|
| 17 |
+
outputs=gr.Textbox(label="Sortie"),
|
| 18 |
+
title="Mon Serveur MCP",
|
| 19 |
+
description="Un exemple de serveur MCP hébergé sur Hugging Face Spaces."
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Activation du support MCP
|
| 23 |
+
demo.launch(mcp=True)
|