-
Notifications
You must be signed in to change notification settings - Fork 57
Description
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)