File size: 2,157 Bytes
93cd57d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""
Проверка статуса сервиса на HuggingFace Spaces
"""
import requests
import time

HF_SERVICE_URL = "https://calcifer0323-matching.hf.space"

print("=" * 70)
print("CHECKING HUGGINGFACE SPACES SERVICE STATUS")
print("=" * 70)

endpoints = [
    "/health",
    "/docs",
    "/"
]

for endpoint in endpoints:
    try:
        print(f"\n🔍 Checking {endpoint}...")
        response = requests.get(
            f"{HF_SERVICE_URL}{endpoint}",
            timeout=10
        )

        print(f"  Status: {response.status_code}")

        if response.status_code == 200:
            print(f"  ✅ Endpoint working")
            if endpoint == "/health":
                data = response.json()
                print(f"     Status: {data.get('status', 'unknown')}")
                print(f"     Model: {data.get('model', 'unknown')}")
                print(f"     Dimensions: {data.get('dimensions', 'unknown')}")
        else:
            print(f"  ⚠️  Endpoint returned {response.status_code}")
            print(f"     Response: {response.text[:200]}")

    except requests.exceptions.Timeout:
        print(f"  ❌ Timeout")
    except requests.exceptions.ConnectionError:
        print(f"  ❌ Connection error")
    except Exception as e:
        print(f"  ❌ Error: {e}")

print("\n" + "=" * 70)
print("TESTING /embed ENDPOINT")
print("=" * 70)

test_text = "3-комнатная квартира в центре Москвы"
payload = {"text": test_text}

try:
    print(f"\n📝 Test text: {test_text}")
    print(f"📤 Sending to /embed...")

    response = requests.post(
        f"{HF_SERVICE_URL}/embed",
        json=payload,
        timeout=30
    )

    print(f"  Status: {response.status_code}")

    if response.status_code == 200:
        data = response.json()
        print(f"  ✅ Success!")
        print(f"     Embedding dimensions: {data.get('dimensions', 'unknown')}")
        print(f"     Model: {data.get('model', 'unknown')}")
    else:
        print(f"  ❌ Error")
        print(f"     Response: {response.text[:500]}")

except Exception as e:
    print(f"  ❌ Failed: {e}")

print("\n" + "=" * 70)