# SageMaker JumpStart provides APIs as part of SageMaker SDK that allow you to deploy and fine-tune models in network isolation using scripts that SageMaker maintains.

from scipy.io.wavfile import read
import json
import boto3
from sagemaker.jumpstart import utils
from sagemaker.jumpstart.model import JumpStartModel


model_id = "huggingface-asr-whisper-large-v2"
key_prefix = "training-datasets/asr_notebook_data"
input_audio_file_name = "sample1.wav"
bucket_name = utils.get_jumpstart_content_bucket(boto3.Session().region_name)

s3 = boto3.client("s3")
s3.download_file(bucket_name, f"{key_prefix}/{input_audio_file_name}", input_audio_file_name)

with open(input_audio_file_name, "rb") as file:
    wav_file_read = file.read()

model = JumpStartModel(model_id=model_id)
predictor = model.deploy()

response = predictor.predict(wav_file_read)
print(response)