Skip to content
Snippets Groups Projects
Commit 55e4b488 authored by Ahmet Öner's avatar Ahmet Öner
Browse files

Enable world level timestamps for OpenAI Whisper

parent 986a18af
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ Unreleased ...@@ -11,7 +11,7 @@ Unreleased
### Changed ### Changed
- Upgraded - Upgraded
- OpenAI Whisper to v20230918 - [openai/whisper](https://github.com/openai/whisper) to [v20230918](https://github.com/openai/whisper/releases/tag/v20230918)
[1.1.1] (2023-05-29) [1.1.1] (2023-05-29)
-------------------- --------------------
... ...
......
...@@ -28,6 +28,8 @@ def transcribe( ...@@ -28,6 +28,8 @@ def transcribe(
options_dict["language"] = language options_dict["language"] = language
if initial_prompt: if initial_prompt:
options_dict["initial_prompt"] = initial_prompt options_dict["initial_prompt"] = initial_prompt
if word_timestamps:
options_dict["word_timestamps"] = word_timestamps
with model_lock: with model_lock:
result = model.transcribe(audio, **options_dict) result = model.transcribe(audio, **options_dict)
... ...
......
...@@ -66,11 +66,7 @@ async def asr( ...@@ -66,11 +66,7 @@ async def asr(
audio_file: UploadFile = File(...), audio_file: UploadFile = File(...),
encode: bool = Query(default=True, description="Encode audio first through ffmpeg"), encode: bool = Query(default=True, description="Encode audio first through ffmpeg"),
output: Union[str, None] = Query(default="txt", enum=["txt", "vtt", "srt", "tsv", "json"]), output: Union[str, None] = Query(default="txt", enum=["txt", "vtt", "srt", "tsv", "json"]),
word_timestamps: bool = Query( word_timestamps: bool = Query(default=False, description="World level timestamps")
default=False,
description="World level timestamps",
include_in_schema=(True if ASR_ENGINE == "faster_whisper" else False)
)
): ):
result = transcribe(load_audio(audio_file.file, encode), task, language, initial_prompt, word_timestamps, output) result = transcribe(load_audio(audio_file.file, encode), task, language, initial_prompt, word_timestamps, output)
return StreamingResponse( return StreamingResponse(
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment