forked from fishaudio/fish-speech
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
43 lines (35 loc) · 1.08 KB
/
Copy pathserver.py
File metadata and controls
43 lines (35 loc) · 1.08 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
#!/usr/bin/env python3
"""
Fish Speech TTS Server Wrapper
Simplified server for Interactive Reader integration
"""
import sys
import os
# Add the project root to the path
sys.path.insert(0, os.path.dirname(__file__))
# Import and run the API server
from tools.api_server import API
import uvicorn
import re
if __name__ == "__main__":
# Initialize with default settings optimized for macOS
api = API()
# Override args for macOS
api.args.device = "mps" if os.system("sysctl -n machdep.cpu.brand_string | grep -q 'Apple'") == 0 else "cpu"
api.args.listen = "0.0.0.0:8883"
api.args.workers = 1
# Parse listen address
match = re.search(r"\[([^\]]+)\]:(\d+)$", api.args.listen)
if match:
host, port = match.groups() # IPv6
else:
host, port = api.args.listen.split(":") # IPv4
print(f"[Fish Speech] Starting server on {host}:{port}")
print(f"[Fish Speech] Device: {api.args.device}")
uvicorn.run(
api.app,
host=host,
port=int(port),
workers=api.args.workers,
log_level="info",
)