morshu-server: use resolved absolute paths and pass env properly
This commit is contained in:
@@ -3,18 +3,22 @@
|
||||
Morshu TTS Server — standalone HTTP API for MorshuTalk engine.
|
||||
Runs on port 3002. GET /say?text=... returns WAV audio.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import io
|
||||
from pathlib import Path
|
||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
|
||||
# Add ttstoy to path so we can import the engine
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
# Add ttstoy root to path so we can import the engine
|
||||
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
TTSTOY_DIR = SCRIPT_DIR.parent
|
||||
sys.path.insert(0, str(TTSTOY_DIR))
|
||||
|
||||
from morshutalk_engine import Morshu
|
||||
|
||||
morshu = Morshu()
|
||||
PORT = 3002
|
||||
PORT = int(os.environ.get("PORT", 3002))
|
||||
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
|
||||
Reference in New Issue
Block a user