Fix image detection after print-to-logging migration #22

Merged
llabeyrie merged 1 commits from fix/app-image-detection into main 2026-03-19 19:15:45 +00:00
Showing only changes of commit e03daea1f3 - Show all commits

5
app.py
View File

@@ -37,6 +37,7 @@ def _extract_image_from_stdout(stdout: str) -> Path | None:
def run_prompt_pipeline(prompt_text: str) -> tuple[Path | None, str, list[str]]:
save_path = "generated_card.png"
cmd = [
sys.executable, "prompt_to_card_pipeline.py",
prompt_text,
@@ -46,7 +47,7 @@ def run_prompt_pipeline(prompt_text: str) -> tuple[Path | None, str, list[str]]:
"--template", "clean-text-to-keywords/json_template_example.json",
"--generator-module", "card_generator_adapter.py",
"--device", "cuda",
"--save-path", "generated_card.png",
"--save-path", save_path,
"--print-json",
]
@@ -63,6 +64,8 @@ def run_prompt_pipeline(prompt_text: str) -> tuple[Path | None, str, list[str]]:
if result.returncode != 0:
return None, full_output.strip() or "Erreur inconnue pendant le pipeline.", cmd
image_path = APP_DIR / save_path
if not image_path.exists():
image_path = _extract_image_from_stdout(result.stdout or "")
return image_path, full_output.strip(), cmd