Tracy André commited on
Commit
8247476
·
1 Parent(s): 6b78689
test_clean_app.py DELETED
@@ -1,50 +0,0 @@
1
- """
2
- Test de l'application après suppression des fonctions safe_*
3
- """
4
-
5
- import os
6
- from mcp_server import create_mcp_interface
7
-
8
- # Hugging Face configuration
9
- hf_token = os.environ.get("HF_TOKEN")
10
- if hf_token:
11
- os.environ["HF_TOKEN"] = hf_token
12
- os.environ["DATASET_ID"] = "HackathonCRA/2024"
13
-
14
- def test_clean_app():
15
- """Test de l'application après nettoyage"""
16
- print("🧪 Test de l'application après suppression des fonctions safe_*...")
17
-
18
- try:
19
- demo = create_mcp_interface()
20
- print("✅ Interface créée avec succès")
21
-
22
- # Test des resources MCP
23
- from mcp_server import (
24
- get_available_plots_resource,
25
- get_dataset_info,
26
- get_plot_info,
27
- list_mcp_resources
28
- )
29
-
30
- print("\n📋 Test des resources MCP:")
31
- print("Plots:", get_available_plots_resource()[:100] + "...")
32
- print("Dataset:", get_dataset_info()[:100] + "...")
33
- print("Plot info:", get_plot_info("Champ ferme W du sol")[:100] + "...")
34
-
35
- print("\n🎯 Application nettoyée et fonctionnelle !")
36
- print("📋 5 onglets disponibles")
37
- print("🔧 12 resources MCP avec @gr.mcp.resource")
38
- print("✅ Fonctions safe_* supprimées")
39
- print("🚀 Prêt pour déploiement")
40
-
41
- return True
42
-
43
- except Exception as e:
44
- print(f"❌ Erreur: {e}")
45
- import traceback
46
- traceback.print_exc()
47
- return False
48
-
49
- if __name__ == "__main__":
50
- test_clean_app()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_final_app.py DELETED
@@ -1,52 +0,0 @@
1
- """
2
- Test final de l'application sans mcp_server
3
- """
4
-
5
- from mcp_server import create_mcp_interface
6
-
7
- def test_final_app():
8
- """Test final de l'application"""
9
- print("🧪 Test final de l'application...")
10
-
11
- try:
12
- demo = create_mcp_interface()
13
- print("✅ Interface créée avec succès")
14
-
15
- # Test des fonctions principales
16
- from mcp_server import analyze_herbicide_trends, predict_future_weed_pressure, recommend_sensitive_crop_plots, explore_raw_data
17
-
18
- # Test rapide des fonctions
19
- print("📈 Test analyse tendances...")
20
- fig, summary = analyze_herbicide_trends(2020, 2024, "Toutes")
21
- if fig is not None:
22
- print("✅ Analyse tendances OK")
23
-
24
- print("🔮 Test prédictions...")
25
- fig, summary = predict_future_weed_pressure()
26
- if fig is not None:
27
- print("✅ Prédictions OK")
28
-
29
- print("🌱 Test recommandations...")
30
- fig, summary = recommend_sensitive_crop_plots()
31
- if fig is not None:
32
- print("✅ Recommandations OK")
33
-
34
- print("📊 Test exploration données...")
35
- fig, summary = explore_raw_data(2020, 2024, "Toutes", "Toutes", "Toutes")
36
- if fig is not None:
37
- print("✅ Exploration données OK")
38
-
39
- print("\n🎯 Application prête pour le déploiement !")
40
- print("📋 Toutes les fonctionnalités sont opérationnelles")
41
- print("🔧 Resources MCP disponibles en tant que fonctions Python")
42
-
43
- return True
44
-
45
- except Exception as e:
46
- print(f"❌ Erreur: {e}")
47
- import traceback
48
- traceback.print_exc()
49
- return False
50
-
51
- if __name__ == "__main__":
52
- test_final_app()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_final_mcp_app.py DELETED
@@ -1,38 +0,0 @@
1
- """
2
- Test final de l'application MCP complète
3
- """
4
-
5
- import os
6
- from mcp_server import create_mcp_interface
7
-
8
- # Hugging Face configuration
9
- hf_token = os.environ.get("HF_TOKEN")
10
- if hf_token:
11
- os.environ["HF_TOKEN"] = hf_token
12
- os.environ["DATASET_ID"] = "HackathonCRA/2024"
13
-
14
- def test_final_mcp_app():
15
- """Test final de l'application MCP complète"""
16
- print("🧪 Test final de l'application MCP complète...")
17
-
18
- try:
19
- demo = create_mcp_interface()
20
- print("✅ Interface créée avec succès")
21
-
22
- # Test du lancement avec mcp_server=True
23
- print("🚀 Test du lancement avec mcp_server=True...")
24
- print("✅ Application prête pour déploiement !")
25
- print("📋 5 onglets disponibles")
26
- print("🔧 12 resources MCP avec @gr.mcp.resource")
27
- print("🎯 mcp_server=True activé")
28
-
29
- return True
30
-
31
- except Exception as e:
32
- print(f"❌ Erreur: {e}")
33
- import traceback
34
- traceback.print_exc()
35
- return False
36
-
37
- if __name__ == "__main__":
38
- test_final_mcp_app()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_fixed_app.py DELETED
@@ -1,37 +0,0 @@
1
- """
2
- Test de l'application corrigée
3
- """
4
-
5
- import os
6
- from mcp_server import create_mcp_interface
7
-
8
- # Hugging Face configuration
9
- hf_token = os.environ.get("HF_TOKEN")
10
- if hf_token:
11
- os.environ["HF_TOKEN"] = hf_token
12
- os.environ["DATASET_ID"] = "HackathonCRA/2024"
13
-
14
- def test_fixed_app():
15
- """Test de l'application avec corrections ASGI"""
16
- print("🧪 Test de l'application corrigée...")
17
-
18
- try:
19
- demo = create_mcp_interface()
20
- print("✅ Interface créée avec succès")
21
-
22
- # Test des fonctions wrapper
23
- from mcp_server import mcp_registry
24
- resources = mcp_registry.list_resources()
25
- print(f"✅ {len(resources)} resources MCP enregistrées")
26
-
27
- print("🎯 Application prête pour déploiement !")
28
- return True
29
-
30
- except Exception as e:
31
- print(f"❌ Erreur: {e}")
32
- import traceback
33
- traceback.print_exc()
34
- return False
35
-
36
- if __name__ == "__main__":
37
- test_fixed_app()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_fixed_syntax.py DELETED
@@ -1,36 +0,0 @@
1
- """
2
- Test de l'application après correction de l'erreur de syntaxe
3
- """
4
-
5
- import os
6
- from mcp_server import create_mcp_interface
7
-
8
- # Hugging Face configuration
9
- hf_token = os.environ.get("HF_TOKEN")
10
- if hf_token:
11
- os.environ["HF_TOKEN"] = hf_token
12
- os.environ["DATASET_ID"] = "HackathonCRA/2024"
13
-
14
- def test_fixed_syntax():
15
- """Test de l'application après correction de l'erreur de syntaxe"""
16
- print("🧪 Test de l'application après correction de l'erreur de syntaxe...")
17
-
18
- try:
19
- demo = create_mcp_interface()
20
- print("✅ Interface créée avec succès")
21
-
22
- print("\n🎯 Application corrigée et fonctionnelle !")
23
- print("📋 4 onglets disponibles (sans Resources MCP)")
24
- print("✅ Erreur de syntaxe corrigée")
25
- print("🚀 Prêt pour déploiement")
26
-
27
- return True
28
-
29
- except Exception as e:
30
- print(f"❌ Erreur: {e}")
31
- import traceback
32
- traceback.print_exc()
33
- return False
34
-
35
- if __name__ == "__main__":
36
- test_fixed_syntax()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_real_mcp.py DELETED
@@ -1,49 +0,0 @@
1
- """
2
- Test des vrais décorateurs MCP Gradio
3
- """
4
-
5
- import os
6
- from mcp_server import create_mcp_interface
7
-
8
- # Hugging Face configuration
9
- hf_token = os.environ.get("HF_TOKEN")
10
- if hf_token:
11
- os.environ["HF_TOKEN"] = hf_token
12
- os.environ["DATASET_ID"] = "HackathonCRA/2024"
13
-
14
- def test_real_mcp():
15
- """Test des vrais décorateurs MCP Gradio"""
16
- print("🧪 Test des vrais décorateurs MCP Gradio...")
17
-
18
- try:
19
- demo = create_mcp_interface()
20
- print("✅ Interface créée avec succès")
21
-
22
- # Test des resources MCP
23
- from mcp_server import (
24
- get_available_plots_resource,
25
- get_dataset_info,
26
- get_plot_info,
27
- list_mcp_resources
28
- )
29
-
30
- print("\n📋 Test des resources MCP:")
31
- print("Plots:", get_available_plots_resource()[:100] + "...")
32
- print("Dataset:", get_dataset_info()[:100] + "...")
33
- print("Plot info:", get_plot_info("Champ ferme W du sol")[:100] + "...")
34
- print("Resources list:", list_mcp_resources()[:200] + "...")
35
-
36
- print("\n🎯 Resources MCP fonctionnelles !")
37
- print("📋 12 resources avec @gr.mcp.resource")
38
- print("🚀 Prêt pour déploiement avec mcp_server=True")
39
-
40
- return True
41
-
42
- except Exception as e:
43
- print(f"❌ Erreur: {e}")
44
- import traceback
45
- traceback.print_exc()
46
- return False
47
-
48
- if __name__ == "__main__":
49
- test_real_mcp()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_resources_simple.py DELETED
@@ -1,34 +0,0 @@
1
- """
2
- Test simple de l'onglet Resources MCP
3
- """
4
-
5
- import gradio as gr
6
- from mcp_server import mcp_registry
7
-
8
- def create_simple_resources_interface():
9
- """Interface simplifiée pour tester l'onglet Resources"""
10
-
11
- with gr.Blocks(title="MCP Resources Test") as demo:
12
- gr.Markdown("# Test Resources MCP")
13
-
14
- with gr.Tab("Resources"):
15
- test_btn = gr.Button("Test Resource")
16
- output = gr.Markdown()
17
-
18
- def test_resource():
19
- try:
20
- resources = mcp_registry.list_resources()
21
- result = "## Resources MCP\n\n"
22
- for uri, info in resources.items():
23
- result += f"- `{uri}`: {info['description']}\n"
24
- return result
25
- except Exception as e:
26
- return f"Error: {str(e)}"
27
-
28
- test_btn.click(test_resource, outputs=[output])
29
-
30
- return demo
31
-
32
- if __name__ == "__main__":
33
- demo = create_simple_resources_interface()
34
- demo.launch(share=True)