NickVerri commited on
Commit
218eb2f
·
verified ·
1 Parent(s): 880bb62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -444,10 +444,11 @@ if uploaded_file:
444
  # Phase 2
445
  status_text.markdown("**Phase 2/4: Transcribing (Whisper)... This is the longest step.**")
446
  compute_type = "float16" if device == "cuda" else "int8"
447
- # Default model size hardcoded to 'large-v2' to keep high quality while removing the sidebar toggle
 
448
  model = whisperx.load_model("large-v2", device, compute_type=compute_type)
449
  audio = whisperx.load_audio("temp_audio.wav")
450
- result = model.transcribe(audio, batch_size=16, language=target_language)
451
  del model
452
  gc.collect()
453
  torch.cuda.empty_cache()
@@ -524,4 +525,5 @@ if uploaded_file:
524
  with st.expander("Show XML/EDL Code", expanded=False):
525
  st.code(final_output, language="xml" if ext == "xml" else "text")
526
 
527
- st.download_button(f"Download .{ext.upper()}", data=final_output, file_name=f"junior_editor_cut.{ext}")
 
 
444
  # Phase 2
445
  status_text.markdown("**Phase 2/4: Transcribing (Whisper)... This is the longest step.**")
446
  compute_type = "float16" if device == "cuda" else "int8"
447
+ # Default model size hardcoded to 'large-v2'.
448
+ # CRITICAL FIX: batch_size lowered from 16 to 4 to prevent CUDA Out Of Memory on long files
449
  model = whisperx.load_model("large-v2", device, compute_type=compute_type)
450
  audio = whisperx.load_audio("temp_audio.wav")
451
+ result = model.transcribe(audio, batch_size=4, language=target_language)
452
  del model
453
  gc.collect()
454
  torch.cuda.empty_cache()
 
525
  with st.expander("Show XML/EDL Code", expanded=False):
526
  st.code(final_output, language="xml" if ext == "xml" else "text")
527
 
528
+ st.download_button(f"Download .{ext.upper()}", data=final_output, file_name=f"junior_editor_cut.{ext}")
529
+