From 269190746bfcfea15cfa4fcd5cc627f84d5e57ac Mon Sep 17 00:00:00 2001 From: Conan Scott Date: Tue, 24 Mar 2026 01:26:27 +0000 Subject: [PATCH] Fix: use fish-audio-sdk (not fishaudio), correct import --- ingest.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ingest.py b/ingest.py index 0135be0..8c95cc7 100644 --- a/ingest.py +++ b/ingest.py @@ -109,18 +109,18 @@ def transcribe_chunk_fish(chunk_path, api_key, start_offset_sec): Returns a list of segments with timestamps adjusted by start_offset_sec. Note: Fish Audio returns timestamps in milliseconds. """ - from fishaudio import FishAudio + from fish_audio_sdk import Session, ASRRequest print(f" → Fish Audio ASR: {chunk_path.name} (offset +{start_offset_sec}s)", flush=True) - client = FishAudio(api_key=api_key) - with open(chunk_path, "rb") as f: - result = client.asr.transcribe(audio=f.read(), language="en") + with Session(api_key) as session: + with open(chunk_path, "rb") as f: + result = session.asr(ASRRequest(audio=f.read(), language="en")) # Fish Audio returns timestamps in milliseconds — convert to seconds # and adjust by the chunk's start offset in the full audio segments = [] - for seg in result.segments: + for seg in (result.segments or []): segments.append({ "start": seg.start / 1000.0 + start_offset_sec, "end": seg.end / 1000.0 + start_offset_sec, @@ -128,7 +128,7 @@ def transcribe_chunk_fish(chunk_path, api_key, start_offset_sec): }) # Fallback: if no segments, use full text as one block - if not segments and result.text: + if not segments and getattr(result, "text", None): segments.append({ "start": start_offset_sec, "end": start_offset_sec + 60,