From cd23e18c6c6deee96f3ce1a777f256231d2e70c7 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Sun, 6 Apr 2025 14:32:01 +0330 Subject: [PATCH] Improved controlnet input by keeping tempfile open during write/read --- tests/test_file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_file.py b/tests/test_file.py index c92802eb..fc3be983 100644 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -126,13 +126,14 @@ async def test_file_prediction(async_flag): with tempfile.NamedTemporaryFile(delete=False) as temp_file: temp_file.write(response.content) + temp_file.seek(0) # Rewind to start so it can be read model = "fofr/flux-dev-controlnet:56ac7b66bd9a1b5eb7d15da5ac5625e4c8c9c5bc26da892caf6249cf38a611ed" input = { "steps": 28, "prompt": "a cyberpunk with natural greys and whites and browns", "control_type": "depth", - "control_image": open(temp_file.name, "rb"), + "control_image": temp_file, # File is still open for reading "output_format": "webp", "guidance_scale": 2.5, "output_quality": 100,