Claude commited on
Commit
cfffdf2
·
1 Parent(s): e1e3c3a

Revert torch pin (broke spaces/ZeroGPU + Wan2.2/LTX-Video); make diarization best-effort and drop pyannote.audio dep. Transcription-only stays GPU-accelerated.

Browse files
Files changed (2) hide show
  1. app.py +17 -7
  2. requirements.txt +2 -4
app.py CHANGED
@@ -200,13 +200,23 @@ def infer_audio(audio_path: str) -> tuple[str, str]:
200
  lines.append(f"[{start:07.2f} -> {end:07.2f}] {text}")
201
  transcript_text = "\n".join(lines) if lines else asr_result.get("text", "")
202
 
203
- diar = _get_diar_pipe()
204
- diarization = diar(audio_path)
205
- turns = [
206
- {"start": round(turn.start, 2), "end": round(turn.end, 2), "speaker": speaker}
207
- for turn, _, speaker in diarization.itertracks(yield_label=True)
208
- ]
209
- diarization_json = json.dumps(turns, indent=2)
 
 
 
 
 
 
 
 
 
 
210
 
211
  return transcript_text, diarization_json
212
 
 
200
  lines.append(f"[{start:07.2f} -> {end:07.2f}] {text}")
201
  transcript_text = "\n".join(lines) if lines else asr_result.get("text", "")
202
 
203
+ try:
204
+ diar = _get_diar_pipe()
205
+ diarization = diar(audio_path)
206
+ turns = [
207
+ {"start": round(turn.start, 2), "end": round(turn.end, 2), "speaker": speaker}
208
+ for turn, _, speaker in diarization.itertracks(yield_label=True)
209
+ ]
210
+ diarization_json = json.dumps(turns, indent=2)
211
+ except Exception as e:
212
+ # pyannote 3.4.0 (required for the gated 3.1 pipeline) needs an older
213
+ # torchaudio than this Space's torch stack ships (needed by Wan2.2 /
214
+ # LTX-Video / spaces itself) — diarization is best-effort here rather
215
+ # than something allowed to take down the whole call.
216
+ print(f"WARN: diarization unavailable: {e}", flush=True)
217
+ diarization_json = json.dumps(
218
+ {"error": "diarization unavailable on this Space (torch version conflict with pyannote)"}
219
+ )
220
 
221
  return transcript_text, diarization_json
222
 
requirements.txt CHANGED
@@ -6,13 +6,11 @@ Pillow>=10.0
6
  scipy>=1.11
7
  imageio>=2.34
8
  imageio-ffmpeg>=0.5
9
- torch==2.2.2
10
- torchvision==0.17.2
11
- torchaudio==2.2.2
12
  diffusers>=0.38.0
13
  transformers>=4.40
14
  accelerate>=0.30
15
  peft>=0.10
16
  spaces>=0.30
17
  sentencepiece>=0.2
18
- pyannote.audio==3.4.0
 
6
  scipy>=1.11
7
  imageio>=2.34
8
  imageio-ffmpeg>=0.5
9
+ torch>=2.2
10
+ torchvision>=0.17
 
11
  diffusers>=0.38.0
12
  transformers>=4.40
13
  accelerate>=0.30
14
  peft>=0.10
15
  spaces>=0.30
16
  sentencepiece>=0.2