Download test_handler.py from MjolnirThor/flan-t5-custom-handler: direct link, hf CLI and curl.
- Browser
- Download file 448 Bytes
-
https://huggingface.co/spaces/MjolnirThor/flan-t5-custom-handler/resolve/main/test_handler.py
- Command line
-
hf download hf://spaces/MjolnirThor/flan-t5-custom-handler/test_handler.py
-
curl -L -o test_handler.py https://huggingface.co/spaces/MjolnirThor/flan-t5-custom-handler/resolve/main/test_handler.py
448 Bytes
| from handler import EndpointHandler | |
| def test_handler(): | |
| # Initialize the handler | |
| handler = EndpointHandler() | |
| # Test with a simple prompt | |
| test_input = { | |
| "inputs": "Explain quantum computing in simple terms" | |
| } | |
| # Get the response | |
| response = handler(test_input) | |
| print("Input:", test_input["inputs"]) | |
| print("Output:", response["generated_text"]) | |
| if __name__ == "__main__": | |
| test_handler() |