Arseniy Savin commited on
Commit
06664bd
·
1 Parent(s): a8277c5

Refactor transcription logic to use n_threads parameter directly

Browse files

Updated the transcription function to accept n_threads as a keyword argument instead of num_proc. This change aligns with the pywhispercpp library's usage and improves clarity in the code.

Files changed (1) hide show
  1. main.py +5 -4
main.py CHANGED
@@ -136,10 +136,11 @@ async def transcribe(
136
  except ValueError:
137
  n_threads = None
138
 
139
- # Run transcription
140
- segments = WHISPER_MODEL_INSTANCE.transcribe(
141
- audio, num_proc=n_threads or 1
142
- )
 
143
 
144
  seg_models: List[Segment] = []
145
  full_text_parts: List[str] = []
 
136
  except ValueError:
137
  n_threads = None
138
 
139
+ # Run transcription (pywhispercpp uses n_threads, not num_proc)
140
+ transcribe_kwargs: Dict[str, int] = {}
141
+ if n_threads:
142
+ transcribe_kwargs["n_threads"] = n_threads
143
+ segments = WHISPER_MODEL_INSTANCE.transcribe(audio, **transcribe_kwargs)
144
 
145
  seg_models: List[Segment] = []
146
  full_text_parts: List[str] = []