shuka-endpoint / test_local.py
shubham24's picture
Upload folder using huggingface_hub
5a67cd8 verified
import base64
import soundfile as sf
from handler import EndpointHandler
def test_endpoint():
# Initialize the handler
handler = EndpointHandler(model_path="sarvamai/shuka-1")
# Load a test audio file (you'll need to provide this)
audio_path = "test_audio.wav"
audio, sr = sf.read(audio_path)
assert sr == 16000, "Audio must be 16kHz"
# Prepare the request
request = {
"audio": base64.b64encode(audio.tobytes()).decode(),
"turns": [
{
"role": "system",
"content": "You are an English teacher helping Indian students learn English."
},
{
"role": "user",
"content": "<|audio|>"
}
]
}
# Call the handler
response = handler(request)
print("Response:", response)
if __name__ == "__main__":
test_endpoint()