Download test/test_image_response_formats.py from zlcy/study: direct link, hf CLI and curl.
- Browser
- Download file 752 Bytes
-
https://huggingface.co/spaces/zlcy/study/resolve/main/test/test_image_response_formats.py
- Command line
-
hf download hf://spaces/zlcy/study/test/test_image_response_formats.py
-
curl -L -o test_image_response_formats.py https://huggingface.co/spaces/zlcy/study/resolve/main/test/test_image_response_formats.py
752 Bytes
| from api.ai import ImageGenerationRequest | |
| from api.image_inputs import _payload_from_fields | |
| from services.protocol.conversation import ConversationRequest | |
| def test_generation_requests_default_to_url() -> None: | |
| request = ImageGenerationRequest(prompt="a cat") | |
| assert request.response_format == "url" | |
| def test_edit_requests_default_to_url() -> None: | |
| payload = _payload_from_fields({"prompt": "make it brighter"}) | |
| assert payload["response_format"] == "url" | |
| def test_explicit_base64_remains_supported() -> None: | |
| request = ImageGenerationRequest(prompt="a cat", response_format="b64_json") | |
| assert request.response_format == "b64_json" | |
| assert ConversationRequest(response_format="b64_json").response_format == "b64_json" | |