Skip to content

Not getting timestamp information with text in Whisper Streaming #296

@usman61

Description

@usman61

Initially I was using whisper truss to translate my videos which gives you timestamp information with the translated text in json format.
but now shifted to whisper streaming model to get the translation text in stream but the whisper streaming just dump the translated text without the timestamp information.
is there any way to get the timestamp with the translated text while using whisper streaming?
I am using the given code snippet example which was provided in whisper stream demo.

import requests
import base64

def wav_to_base64(file_path):
with open(file_path, "rb") as wav_file:
binary_data = wav_file.read()
base64_data = base64.b64encode(binary_data)
base64_string = base64_data.decode("utf-8")
return base64_string

resp = requests.post(
"https://model-.api.baseten.co/development/predict",
headers = {"Authorization": "Api-Key BASETEN-API-KEY"},
json={"audio": wav_to_base64("/path/to/wav/input_audio_file.wav")},
stream=True
)

for content in resp.iter_content():
print(content.decode("utf-8"), end="", flush=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions