diff options
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 +} |
