Phase 3: Speaker diarization and full transcription pipeline
- Implement DiarizeService with pyannote.audio speaker detection - Build PipelineService combining transcribe → diarize → merge with overlap-based speaker assignment per segment - Add pipeline.start and diarize.start IPC handlers - Add run_pipeline Tauri command for full pipeline execution - Wire frontend to use pipeline: speakers auto-created with colors, segments assigned to detected speakers - Build SpeakerManager with rename support (double-click or edit button) - Add speaker color coding throughout transcript display - Add pyannote.audio dependency - Tests: 24 Python (including merge logic), 6 Rust, 0 Svelte errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,3 +50,55 @@ pub fn transcribe_file(
|
||||
|
||||
Ok(response.payload)
|
||||
}
|
||||
|
||||
/// Run the full transcription + diarization pipeline via the Python sidecar.
|
||||
#[tauri::command]
|
||||
pub fn run_pipeline(
|
||||
file_path: String,
|
||||
model: Option<String>,
|
||||
device: Option<String>,
|
||||
language: Option<String>,
|
||||
num_speakers: Option<u32>,
|
||||
min_speakers: Option<u32>,
|
||||
max_speakers: Option<u32>,
|
||||
skip_diarization: Option<bool>,
|
||||
) -> Result<Value, String> {
|
||||
let python_path = std::env::current_dir()
|
||||
.map_err(|e| e.to_string())?
|
||||
.join("../python")
|
||||
.canonicalize()
|
||||
.map_err(|e| format!("Cannot find python directory: {e}"))?;
|
||||
|
||||
let python_path_str = python_path.to_string_lossy().to_string();
|
||||
|
||||
let manager = SidecarManager::new();
|
||||
manager.start(&python_path_str)?;
|
||||
|
||||
let request_id = uuid::Uuid::new_v4().to_string();
|
||||
let msg = IPCMessage::new(
|
||||
&request_id,
|
||||
"pipeline.start",
|
||||
json!({
|
||||
"file": file_path,
|
||||
"model": model.unwrap_or_else(|| "base".to_string()),
|
||||
"device": device.unwrap_or_else(|| "cpu".to_string()),
|
||||
"compute_type": "int8",
|
||||
"language": language,
|
||||
"num_speakers": num_speakers,
|
||||
"min_speakers": min_speakers,
|
||||
"max_speakers": max_speakers,
|
||||
"skip_diarization": skip_diarization.unwrap_or(false),
|
||||
}),
|
||||
);
|
||||
|
||||
let response = manager.send_and_receive(&msg)?;
|
||||
|
||||
if response.msg_type == "error" {
|
||||
return Err(format!(
|
||||
"Pipeline error: {}",
|
||||
response.payload.get("message").and_then(|v| v.as_str()).unwrap_or("unknown")
|
||||
));
|
||||
}
|
||||
|
||||
Ok(response.payload)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user