Spaces:
Sleeping
Sleeping
| """ | |
| Test des vrais décorateurs MCP Gradio | |
| """ | |
| import os | |
| from mcp_server import create_mcp_interface | |
| # Hugging Face configuration | |
| hf_token = os.environ.get("HF_TOKEN") | |
| if hf_token: | |
| os.environ["HF_TOKEN"] = hf_token | |
| os.environ["DATASET_ID"] = "HackathonCRA/2024" | |
| def test_real_mcp(): | |
| """Test des vrais décorateurs MCP Gradio""" | |
| print("🧪 Test des vrais décorateurs MCP Gradio...") | |
| try: | |
| demo = create_mcp_interface() | |
| print("✅ Interface créée avec succès") | |
| # Test des resources MCP | |
| from mcp_server import ( | |
| get_available_plots_resource, | |
| get_dataset_info, | |
| get_plot_info, | |
| list_mcp_resources | |
| ) | |
| print("\n📋 Test des resources MCP:") | |
| print("Plots:", get_available_plots_resource()[:100] + "...") | |
| print("Dataset:", get_dataset_info()[:100] + "...") | |
| print("Plot info:", get_plot_info("Champ ferme W du sol")[:100] + "...") | |
| print("Resources list:", list_mcp_resources()[:200] + "...") | |
| print("\n🎯 Resources MCP fonctionnelles !") | |
| print("📋 12 resources avec @gr.mcp.resource") | |
| print("🚀 Prêt pour déploiement avec mcp_server=True") | |
| return True | |
| except Exception as e: | |
| print(f"❌ Erreur: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| return False | |
| if __name__ == "__main__": | |
| test_real_mcp() | |