diff options
| author | soryu <soryu@soryu.co> | 2025-12-20 15:36:04 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2025-12-23 14:47:18 +0000 |
| commit | 01088f4f1915e36a7d0d8d8756f62f8207a48911 (patch) | |
| tree | 8fdbba900f3f4bba32bae76e2e0378848a90cf93 /makima/src/bin | |
| parent | ab9166170043ba5e0ce974e5b7accf0939d686e3 (diff) | |
| download | soryu-01088f4f1915e36a7d0d8d8756f62f8207a48911.tar.gz soryu-01088f4f1915e36a7d0d8d8756f62f8207a48911.zip | |
Implement makima listen websockets server
Diffstat (limited to 'makima/src/bin')
| -rw-r--r-- | makima/src/bin/server.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/makima/src/bin/server.rs b/makima/src/bin/server.rs new file mode 100644 index 0000000..7117cfe --- /dev/null +++ b/makima/src/bin/server.rs @@ -0,0 +1,40 @@ +//! Makima Audio API Server binary. +//! +//! This server provides WebSocket-based speech-to-text streaming +//! and HTTP-based text-to-speech synthesis with voice cloning. + +use std::sync::Arc; + +use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; + +use makima::server::{run_server, state::AppState}; + +/// Default model paths relative to the working directory. +const PARAKEET_MODEL_DIR: &str = "models/parakeet-tdt-0.6b-v3"; +const SORTFORMER_MODEL_PATH: &str = "models/diarization/diar_streaming_sortformer_4spk-v2.onnx"; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + // Initialize tracing subscriber with environment filter + tracing_subscriber::registry() + .with( + tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| "makima=debug,tower_http=debug".into()), + ) + .with(tracing_subscriber::fmt::layer()) + .init(); + + tracing::info!("Starting Makima Audio API Server"); + tracing::info!("Loading ML models..."); + + // Load all ML models + let state = Arc::new( + AppState::new(PARAKEET_MODEL_DIR, SORTFORMER_MODEL_PATH, None) + .map_err(|e| anyhow::anyhow!("Failed to load models: {}", e))?, + ); + + tracing::info!("Models loaded successfully"); + + // Run the server + run_server(state, "0.0.0.0:8080").await +} |
