#!/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()