40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
import os
|
|
import sys
|
|
import uvicorn
|
|
import gradio as gr
|
|
|
|
if hasattr(sys.stdout, "reconfigure"):
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
from vocoloom.api import app, get_manager
|
|
from vocoloom.webui import create_ui
|
|
|
|
manager = get_manager()
|
|
|
|
# Preload first available voice into VRAM for instant response
|
|
if manager.voices:
|
|
first_voice_id = list(manager.voices.keys())[0]
|
|
try:
|
|
manager.load_voice(first_voice_id)
|
|
except Exception as e:
|
|
print(f"[VocoLoom Server] Vorladen von '{first_voice_id}' fehlgeschlagen: {e}")
|
|
|
|
demo, custom_css = create_ui(manager)
|
|
app = gr.mount_gradio_app(
|
|
app,
|
|
demo,
|
|
path="/",
|
|
allowed_paths=[manager.root_dir, manager.voices_dir]
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
port = int(os.environ.get("VOCOLOOM_PORT", 7860))
|
|
host = os.environ.get("VOCOLOOM_HOST", "0.0.0.0")
|
|
print(f"\n=======================================================")
|
|
print(f"🚀 VocoLoom Multi-Voice Platform Server gestartet!")
|
|
print(f"🌐 Web Studio: http://localhost:{port}/")
|
|
print(f"📡 REST API: http://localhost:{port}/api/v1/voices")
|
|
print(f"📖 Docs: http://localhost:{port}/docs")
|
|
print(f"=======================================================\n")
|
|
uvicorn.run(app, host=host, port=port)
|