Spaces:
Sleeping
Sleeping
| """ | |
| Quick script to check your HF Space logs and status | |
| """ | |
| import os | |
| from huggingface_hub import HfApi | |
| # Configuration | |
| YOUR_USERNAME = "nocapdev" | |
| SPACE_NAME = "my-gradio-momask" | |
| TOKEN = os.getenv("HUGGINGFACE_TOKEN") | |
| def check_space_status(): | |
| print("=" * 70) | |
| print(" " * 20 + "HF Space Status Check") | |
| print("=" * 70) | |
| if not TOKEN: | |
| print("❌ ERROR: HUGGINGFACE_TOKEN not set") | |
| print("Set it with: $env:HUGGINGFACE_TOKEN = 'hf_your_token'") | |
| return | |
| api = HfApi(token=TOKEN) | |
| repo_id = f"{YOUR_USERNAME}/{SPACE_NAME}" | |
| try: | |
| # Get space info | |
| print(f"\n📍 Checking Space: {repo_id}") | |
| print(f" URL: https://huggingface.co/spaces/{repo_id}") | |
| # Get runtime info | |
| runtime = api.get_space_runtime(repo_id=repo_id) | |
| print(f"\n🔧 Runtime Status:") | |
| print(f" Stage: {runtime.stage}") | |
| print(f" Hardware: {runtime.hardware}") | |
| print(f" SDK: {runtime.sdk}") | |
| if runtime.stage == "RUNNING": | |
| print(" ✅ Space is RUNNING") | |
| elif runtime.stage == "BUILDING": | |
| print(" ⏳ Space is BUILDING...") | |
| else: | |
| print(f" ⚠️ Stage: {runtime.stage}") | |
| print("\n💡 Next Steps:") | |
| print(f" 1. Visit: https://huggingface.co/spaces/{repo_id}") | |
| print(f" 2. Click 'Logs' tab to see detailed output") | |
| print(f" 3. Look for errors or 'Using device: cpu/cuda'") | |
| if runtime.hardware and 'cpu' in runtime.hardware.lower(): | |
| print("\n⚠️ WARNING: Using CPU hardware") | |
| print(" • Generation will be VERY slow (10-30 minutes)") | |
| print(" • Consider upgrading to GPU in Space Settings") | |
| except Exception as e: | |
| print(f"\n❌ Error checking space: {e}") | |
| print("\nManual check:") | |
| print(f" Visit: https://huggingface.co/spaces/{repo_id}") | |
| print(" Check the Logs tab for detailed information") | |
| print("\n" + "=" * 70) | |
| if __name__ == "__main__": | |
| check_space_status() | |