| | |
| | """ |
| | Test script to verify Hugging Face Spaces configuration |
| | """ |
| |
|
| | import os |
| | import sys |
| |
|
| | def check_huggingface_config(): |
| | """Check if Hugging Face configuration is correct""" |
| | print("Checking Hugging Face Spaces configuration...") |
| | |
| | |
| | if not os.path.exists("README.md"): |
| | print("❌ README.md file not found") |
| | return False |
| | |
| | with open("README.md", "r", encoding="utf-8") as f: |
| | content = f.read() |
| | |
| | |
| | if not content.startswith("---"): |
| | print("❌ README.md missing configuration section") |
| | return False |
| | |
| | |
| | required_fields = ["title:", "emoji:", "colorFrom:", "colorTo:", "sdk:", "app_file:"] |
| | for field in required_fields: |
| | if field not in content: |
| | print(f"❌ README.md missing required field: {field}") |
| | return False |
| | |
| | print("✅ README.md configuration section is correct") |
| | |
| | |
| | if not os.path.exists("Dockerfile"): |
| | print("❌ Dockerfile not found") |
| | return False |
| | print("✅ Dockerfile found") |
| | |
| | |
| | if not os.path.exists("docker-compose.yml"): |
| | print("❌ docker-compose.yml not found") |
| | return False |
| | print("✅ docker-compose.yml found") |
| | |
| | |
| | if not os.path.exists("src"): |
| | print("❌ src directory not found") |
| | return False |
| | print("✅ src directory found") |
| | |
| | |
| | if not os.path.exists("requirements.txt"): |
| | print("❌ requirements.txt not found") |
| | return False |
| | print("✅ requirements.txt found") |
| | |
| | print("\n🎉 All Hugging Face Spaces configuration checks passed!") |
| | print("\nTo deploy to Hugging Face Spaces:") |
| | print("1. Create a new Space at https://huggingface.co/spaces/new") |
| | print("2. Select 'Docker' as the SDK") |
| | print("3. Upload all files in this directory to your Space repository") |
| | print("4. The Space will automatically build and deploy") |
| | |
| | return True |
| |
|
| | if __name__ == "__main__": |
| | success = check_huggingface_config() |
| | sys.exit(0 if success else 1) |