Commit Graph

11 Commits

Author SHA1 Message Date
fe830dea2e Fix LoRA loading and conditioning to match training notebook
card_generator_adapter.py had two mismatches with the training notebook:

1. LoRA loading: used pipe.load_lora_weights() (diffusers format) but the
   adapter was saved with PEFT's save_pretrained() — keys didn't match,
   so no LoRA weights were actually applied. Now uses
   PeftModel.from_pretrained() + merge_and_unload().

2. Conditioning: built a natural language prompt, but the LoRA was trained
   on json.dumps(meta) serialization. Now uses JSON serialization to match.
2026-03-20 00:28:05 +01:00
dbf4946875 Merge pull request 'Fix image detection after print-to-logging migration' (#22) from fix/app-image-detection into main
Reviewed-on: #22
2026-03-19 19:15:44 +00:00
e03daea1f3 Fix image detection after print-to-logging migration
app.py relied on parsing stdout for the save path printed by the
pipeline. After PR #21 replaced that print with logger.info(), the
stdout parsing returned None, causing "Aucune image générée détectée".

Now check the known save path directly (APP_DIR / save_path) and
only fall back to stdout parsing if the file isn't found.
2026-03-19 20:14:17 +01:00
984bbbec18 Merge pull request 'Replace debug print() statements with proper logging' (#21) from fix/replace-print-with-logging into main
Reviewed-on: #21
2026-03-19 19:06:40 +00:00
e1317b5839 Replace debug print() statements with proper logging
Replace 27 unconditional print() calls with Python's logging module.
Debug messages now use logger.debug() and the card-saved message uses
logger.info(). Only legitimate user-facing output (--print-json,
--print-clean-text) remains on stdout.

Fixes #3
2026-03-19 19:45:09 +01:00
d97dadfb34 Merge pull request 'Fix bare except handlers in keyword_extractor.py' (#20) from fix/narrow-except-handlers into main
Reviewed-on: #20
2026-03-19 18:39:36 +00:00
3cfb18be11 Narrow bare except handlers in keyword_extractor.py
Replace broad `except Exception` with `except ImportError` for the yake
import and `except (ValueError, TypeError)` for YAKE extraction. Add
logging so failures are no longer silently swallowed.

Fixes #4
2026-03-19 19:32:06 +01:00
9b6fd1d95a Merge pull request 'fix: broken subprocess command and tuple unpacking in app.py' (#19) from fix/app-critical-bugs into main
Reviewed-on: #19
2026-03-19 18:16:15 +00:00
577308af17 fix: extract image path from prefixed stdout line
_extract_image_from_stdout() failed to find the generated image because
the pipeline prints "Card generated and saved to: generated_card.png"
but the function only tried the full line as a path. Now also tries the
part after the last colon.
2026-03-19 19:12:29 +01:00
94b927c06b fix: broken subprocess command and tuple unpacking in app.py
Fix two critical bugs that made the Streamlit app completely non-functional:

1. Split subprocess command into properly separated list elements and use
   sys.executable instead of hardcoded "python" (#1)
2. Unpack all 3 return values from run_prompt_pipeline() (#2)

Closes #1, closes #2
2026-03-19 18:42:25 +01:00
584b2e07b4 first commit 2026-03-19 18:16:20 +01:00