-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_fast.py
More file actions
55 lines (45 loc) · 1.5 KB
/
run_fast.py
File metadata and controls
55 lines (45 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
"""
CosyVoice2 API Fast Startup Script
This script starts the server without environment checks for faster startup
"""
import os
import sys
import subprocess
import logging
# Setup logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
def main():
"""Fast startup without environment checks"""
print("🚀 CosyVoice2 API - Fast Startup")
print("================================")
# Check if we're in the right directory
if not os.path.exists('main.py'):
logger.error("main.py not found. Please run from the project root directory.")
sys.exit(1)
# Start server directly
print("🌐 Server will be available at: http://localhost:8012")
print("📚 API Documentation: http://localhost:8012/docs")
print("🔄 Starting server...")
print("")
try:
# Use uvicorn directly
cmd = [
sys.executable, "-m", "uvicorn",
"main:app",
"--host", "0.0.0.0",
"--port", "8012",
"--workers", "1"
]
subprocess.run(cmd, check=True)
except KeyboardInterrupt:
print("\n👋 Server stopped by user")
except subprocess.CalledProcessError as e:
logger.error(f"Failed to start server: {e}")
sys.exit(1)
except Exception as e:
logger.error(f"Unexpected error: {e}")
sys.exit(1)
if __name__ == "__main__":
main()