Spaces:
Runtime error

nigash-voice-api / deploy_check.py
Nigash's picture
Upload 13 files
9dd7fd5 verified
Raw History Blame Contribute Delete
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()