true, 'whisper_bin_exists'=>file_exists('/opt/whisper.cpp/main'), 'xtts_dir_exists'=>is_dir('/opt/xtts'), 'endpoints'=>['transcribe','synthesize','status','get_audio'] ]); exit; } if ($action === 'transcribe' && isset($_FILES['audio'])) { $wh = '/opt/whisper.cpp/main'; if (!file_exists($wh)) { echo json_encode(['ok'=>false,'error'=>'whisper not compiled']); exit; } $out = shell_exec('timeout 30 '.$wh.' -m /opt/whisper.cpp/models/ggml-base.bin -f '.escapeshellarg($_FILES['audio']['tmp_name']).' 2>&1'); echo json_encode(['ok'=>true,'text'=>$out]); exit; } echo json_encode(['ok'=>false,'actions'=>['status','transcribe','synthesize','get_audio']]);