File size: 1,004 Bytes
4e45b0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import asyncio
from client import CsvCleanerEnv
try:
    from server.tasks import TASKS
except ImportError:
    TASKS = {"fix_column_types": None, "clean_missing_duplicates": None, "full_pipeline": None}

async def test_space():
    url = "https://printf-sourav-csv-dc-env.hf.space"
    print(f"Connecting to {url}...")
    try:
        env = CsvCleanerEnv(base_url=url)
        for task_name in TASKS.keys():
            print(f"\\nTesting task: {task_name}")
            result = await env.reset(task=task_name)
            print(f"✅ Reset successful. Result: {result}")
            
            # test one simple MCP call
            tools = await env.list_tools()
            if "get_dataset_info" in tools:
                print("✅ Toolkit active.")
                
        await env.close()
        print("\\nAll tasks reachable and responsive in HF Space!")
    except Exception as e:
        print(f"Failed to connect or test: {e}")

if __name__ == "__main__":
    asyncio.run(test_space())