Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: run Detailer inpaints on the image-generation pool (#17188)

Daniel Han185abcf9c8e9
diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py
index 80bbd151694..59b8d662c73 100644
--- a/studio/backend/routes/inference.py
+++ b/studio/backend/routes/inference.py
@@ -50088,7 +50088,8 @@ async def _generate_diffusion_image_run(
_diffusion_persist_active += 1
try:
with account_access.media_generation("diffusion"):
- await asyncio.to_thread(
+ # Crop inpaints wait on the render slot too, so use the same pool.
+ await _image_generate_in_thread(
_run_detailer, backend, request, result, enhancement, detailer
)
except BaseException:
diff --git a/studio/backend/tests/test_image_generate_executor.py b/studio/backend/tests/test_image_generate_executor.py
index b8dcca9cbe1..eded78a1d85 100644
--- a/studio/backend/tests/test_image_generate_executor.py
+++ b/studio/backend/tests/test_image_generate_executor.py
@@ -5,6 +5,7 @@
from __future__ import annotations
+import ast
import asyncio
import contextvars
import threading
@@ -88,3 +89,20 @@ def test_results_and_errors_pass_through(monkeypatch, raises):
asyncio.run(main())
else:
assert asyncio.run(main()) == 3
+
+
+def _render_slot_dispatches(name: str) -> list[str]:
+ tree = ast.parse(open(inference.__file__, encoding = "utf-8").read())
+ callees = []
+ for node in ast.walk(tree):
+ if not (isinstance(node, ast.Await) and isinstance(node.value, ast.Call)):
+ continue
+ call = node.value
+ if call.args and isinstance(call.args[0], ast.Name) and call.args[0].id == name:
+ callees.append(ast.unparse(call.func))
+ return callees
+
+
+def test_detailer_inpaints_wait_on_the_image_pool():
+ callees = _render_slot_dispatches("_run_detailer")
+ assert callees == ["_image_generate_in_thread"], callees