File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,12 @@ const char * whisper_token_to_str_wrapper(struct whisper_context_wrapper * ctx_w
133133 return whisper_token_to_str (ctx_w->ptr , token);
134134};
135135
136+ py::bytes whisper_token_to_bytes_wrapper (struct whisper_context_wrapper * ctx_w, whisper_token token){
137+ const char * str = whisper_token_to_str (ctx_w->ptr , token);
138+ size_t l = strlen (str);
139+ return py::bytes (str, l);
140+ }
141+
136142whisper_token whisper_token_eot_wrapper (struct whisper_context_wrapper * ctx_w){
137143 return whisper_token_eot (ctx_w->ptr );
138144}
@@ -494,6 +500,7 @@ PYBIND11_MODULE(_pywhispercpp, m) {
494500
495501
496502 m.def (" whisper_token_to_str" , &whisper_token_to_str_wrapper, " whisper_token_to_str" );
503+ m.def (" whisper_token_to_bytes" , &whisper_token_to_bytes_wrapper, " whisper_token_to_bytes" );
497504 m.def (" whisper_token_eot" , &whisper_token_eot_wrapper, " whisper_token_eot" );
498505 m.def (" whisper_token_sot" , &whisper_token_sot_wrapper, " whisper_token_sot" );
499506 m.def (" whisper_token_prev" , &whisper_token_prev_wrapper);
You can’t perform that action at this time.
0 commit comments