Spaces:
Runtime error
Runtime error
Download deploy_check.py from Nigash/nigash-voice-api: direct link, hf CLI and curl.
- Browser
- Download file 3.71 kB
-
https://huggingface.co/spaces/Nigash/nigash-voice-api/resolve/main/deploy_check.py
- Command line
-
hf download hf://spaces/Nigash/nigash-voice-api/deploy_check.py
-
curl -L -o deploy_check.py https://huggingface.co/spaces/Nigash/nigash-voice-api/resolve/main/deploy_check.py
3.71 kB
| #!/usr/bin/env python3 | |
| """ | |
| Deployment verification script for Hugging Face Spaces | |
| Run this after uploading your files to verify everything is set up correctly | |
| """ | |
| import os | |
| import sys | |
| def check_files(): | |
| """Check if all required files are present""" | |
| required_files = [ | |
| "app.py", | |
| "requirements.txt", | |
| "modules.py", | |
| "pipeline.py", | |
| "Nigash_voice.pth" | |
| ] | |
| optional_files = [ | |
| "app_config.py", | |
| "client_example.py", | |
| "README.md", | |
| ".gitignore" | |
| ] | |
| print("π Checking required files...") | |
| missing_files = [] | |
| for file in required_files: | |
| if os.path.exists(file): | |
| print(f"β {file}") | |
| else: | |
| print(f"β {file} - MISSING!") | |
| missing_files.append(file) | |
| print("\nπ Checking optional files...") | |
| for file in optional_files: | |
| if os.path.exists(file): | |
| print(f"β {file}") | |
| else: | |
| print(f"β οΈ {file} - Optional file missing") | |
| return len(missing_files) == 0 | |
| def check_dependencies(): | |
| """Check if requirements.txt has all necessary dependencies""" | |
| print("\nπ¦ Checking dependencies...") | |
| if not os.path.exists("requirements.txt"): | |
| print("β requirements.txt not found!") | |
| return False | |
| with open("requirements.txt", "r") as f: | |
| content = f.read() | |
| required_deps = [ | |
| "gradio", | |
| "torch", | |
| "coqui-tts", | |
| "fastapi", | |
| "uvicorn" | |
| ] | |
| missing_deps = [] | |
| for dep in required_deps: | |
| if dep in content: | |
| print(f"β {dep}") | |
| else: | |
| print(f"β {dep} - MISSING!") | |
| missing_deps.append(dep) | |
| return len(missing_deps) == 0 | |
| def check_model_file(): | |
| """Check if the model file exists and has reasonable size""" | |
| print("\nπ€ Checking model file...") | |
| if not os.path.exists("Nigash_voice.pth"): | |
| print("β Nigash_voice.pth not found!") | |
| return False | |
| size_mb = os.path.getsize("Nigash_voice.pth") / (1024 * 1024) | |
| print(f"β Nigash_voice.pth - {size_mb:.1f} MB") | |
| if size_mb < 10: | |
| print("β οΈ Model file seems small, might be corrupted") | |
| return False | |
| return True | |
| def main(): | |
| """Main verification function""" | |
| print("π Hugging Face Spaces Deployment Verification") | |
| print("=" * 50) | |
| all_good = True | |
| # Check files | |
| if not check_files(): | |
| all_good = False | |
| # Check dependencies | |
| if not check_dependencies(): | |
| all_good = False | |
| # Check model file | |
| if not check_model_file(): | |
| all_good = False | |
| print("\n" + "=" * 50) | |
| if all_good: | |
| print("π All checks passed! Your Space should deploy successfully.") | |
| print("\nπ Next steps:") | |
| print("1. Wait for the Space to build (check the 'Settings' tab)") | |
| print("2. Test the API endpoints:") | |
| print(" - Web interface: https://your-space-url.hf.space") | |
| print(" - Health check: https://your-space-url.hf.space/health") | |
| print(" - API endpoint: POST https://your-space-url.hf.space/convert") | |
| else: | |
| print("β Some issues found. Please fix them before deployment.") | |
| print("\nπ‘ Common fixes:") | |
| print("- Make sure all files are uploaded") | |
| print("- Check that requirements.txt has all dependencies") | |
| print("- Verify the model file is not corrupted") | |
| return all_good | |
| if __name__ == "__main__": | |
| main() |