Spaces:
Sleeping
Sleeping
| """ | |
| Проверка статуса сервиса на 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) | |