Download test_handler.py from Adriaanvh1/whisper-tiny-handler: direct link, hf CLI and curl.
- Browser
- Download file 400 Bytes
-
https://huggingface.co/Adriaanvh1/whisper-tiny-handler/resolve/main/test_handler.py
- Command line
-
hf download hf://Adriaanvh1/whisper-tiny-handler/test_handler.py
-
curl -L -o test_handler.py https://huggingface.co/Adriaanvh1/whisper-tiny-handler/resolve/main/test_handler.py
400 Bytes
| """Test the custom handler.""" | |
| from handler import EndpointHandler | |
| import os | |
| import base64 | |
| handler = EndpointHandler(path="whisper-tiny") | |
| with open("frank.wav", "rb") as file: | |
| audio = file.read() | |
| audio = base64.b64encode(audio) | |
| payload = {"inputs": {"audio": audio, "language": "nl", "task": "transcribe"}} | |
| output = handler(payload) | |
| print(output["text"]) | |
| print("\n") | |
| print(output["chunks"]) |