File size: 764 Bytes
af07018
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from gradio_client import Client
import time

try:
    print("Connecting to Space...")
    # Use the public Space URL
    client = Client("https://oldmonk69-dock.hf.space", timeout=120)
    print("Connected successfully!")
    
    # Test the connection
    result = client.predict("Hello", api_name="/predict")  # Adjust API name as needed
    print(f"Test result: {result}")
    
except Exception as e:
    print(f"Connection failed: {e}")
    print("Trying alternative connection method...")
    
    # Alternative: Try with just the space name
    try:
        client = Client("oldmonk69/Dock", timeout=120)
        print("Connected with space name!")
    except Exception as e2:
        print(f"Alternative connection also failed: {e2}")