import whisper
import json
import sys

print("Carregando modelo turbo...", flush=True)
model = whisper.load_model("turbo")

print("Transcrevendo audio...", flush=True)
result = model.transcribe(
    "/opt/mia/workspace/videos/borrello_lives/cortes_feng_shui/audio_source.wav",
    language="pt",
    word_timestamps=True,
    verbose=False
)

print(f"Segmentos: {len(result['segments'])}", flush=True)

with open("/opt/mia/workspace/videos/borrello_lives/cortes_feng_shui/transcript_raw.json", "w") as f:
    json.dump(result, f, ensure_ascii=False, indent=2)

print("Salvo em transcript_raw.json", flush=True)
