Download test/test_generations_url.py from zlcy/study: direct link, hf CLI and curl.
- Browser
- Download file 429 Bytes
-
https://huggingface.co/spaces/zlcy/study/resolve/main/test/test_generations_url.py
- Command line
-
hf download hf://spaces/zlcy/study/test/test_generations_url.py
-
curl -L -o test_generations_url.py https://huggingface.co/spaces/zlcy/study/resolve/main/test/test_generations_url.py
429 Bytes
| from test.utils import post_json | |
| def main() -> None: | |
| result = post_json( | |
| "/v1/images/generations", | |
| { | |
| "prompt": "一只橘猫坐在窗边,午后阳光,写实摄影", | |
| "model": "gpt-image-2", | |
| "n": 1, | |
| "response_format": "url", | |
| }, | |
| ) | |
| for item in result.get("data", []): | |
| print(item.get("url", "")) | |
| if __name__ == "__main__": | |
| main() | |