diff --git a/app.py b/app.py index 0b4b828..cce9f23 100644 --- a/app.py +++ b/app.py @@ -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,7 +64,9 @@ 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 = _extract_image_from_stdout(result.stdout or "") + 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 # ------------------------------------------------------------------ #