File size: 1,058 Bytes
a321b61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
#!/usr/bin/env python3
"""Test API connection to HF Space"""
import sys
sys.stdout.reconfigure(encoding='utf-8', errors='replace')

import os
from dotenv import load_dotenv
load_dotenv()

from gradio_client import Client

hf_token = os.getenv("HF_TOKEN")
print("Attempting to connect to Space...", flush=True)

try:
    client = Client("evgueni-p/fbmc-chronos2", hf_token=hf_token)
    print("[OK] Connected successfully!", flush=True)

    # Check available endpoints
    print("\nAvailable API endpoints:", flush=True)
    print(f"Endpoints: {client.endpoints}", flush=True)

    print("\nSpace is running. Testing smoke test API call...", flush=True)

    # Try a smoke test - let Gradio auto-detect the endpoint
    result = client.predict(
        "2025-09-30",  # run_date
        "smoke_test",  # forecast_type
    )
    print(f"[OK] API call successful!", flush=True)
    print(f"Result file: {result}", flush=True)

except Exception as e:
    print(f"[ERROR] {type(e).__name__}: {str(e)}", flush=True)
    import traceback
    traceback.print_exc()