Spaces:
Running
Running
#!/usr/bin/env python3 | |
""" | |
Simple build test for C-3PO TTS API | |
Tests if all dependencies can be imported | |
""" | |
def test_imports(): | |
"""Test if all required packages can be imported""" | |
print("π Testing imports...") | |
try: | |
import fastapi | |
print("β FastAPI") | |
import uvicorn | |
print("β Uvicorn") | |
import torch | |
print("β PyTorch") | |
import torchaudio | |
print("β TorchAudio") | |
import TTS | |
print("β Coqui TTS") | |
import huggingface_hub | |
print("β Hugging Face Hub") | |
import pydantic | |
print("β Pydantic") | |
return True | |
except ImportError as e: | |
print(f"β Import failed: {e}") | |
return False | |
def test_api_creation(): | |
"""Test if the API can be created without errors""" | |
print("\nπ Testing API creation...") | |
try: | |
from coqui_api import app | |
print("β API created successfully") | |
return True | |
except Exception as e: | |
print(f"β API creation failed: {e}") | |
return False | |
def main(): | |
"""Run build tests""" | |
print("π§ͺ C-3PO TTS Build Test") | |
print("=" * 30) | |
import_ok = test_imports() | |
api_ok = test_api_creation() | |
print("\n" + "=" * 30) | |
if import_ok and api_ok: | |
print("π All tests passed! Ready to deploy.") | |
return 0 | |
else: | |
print("β Some tests failed. Check dependencies.") | |
return 1 | |
if __name__ == "__main__": | |
exit(main()) |