fix: broken subprocess command and tuple unpacking in app.py #19
14
app.py
14
app.py
@@ -33,10 +33,16 @@ def _extract_image_from_stdout(stdout: str) -> Path | None:
|
|||||||
|
|
||||||
def run_prompt_pipeline(prompt_text: str) -> tuple[Path | None, str, list[str]]:
|
def run_prompt_pipeline(prompt_text: str) -> tuple[Path | None, str, list[str]]:
|
||||||
cmd = [
|
cmd = [
|
||||||
"python prompt_to_card_pipeline.py ",
|
sys.executable, "prompt_to_card_pipeline.py",
|
||||||
prompt_text,
|
prompt_text,
|
||||||
"--text-cleaner-path text-cleaner/text_cleaning_pipeline.py --infer-script-path clean-text-to-keywords/infer_json_usage.py --checkpoint pokemon_card_lora --template clean-text-to-keywords/json_template_example.json --generator-module card_generator_adapter.py --device cuda --save-path generated_card.png --print-json"
|
"--text-cleaner-path", "text-cleaner/text_cleaning_pipeline.py",
|
||||||
|
"--infer-script-path", "clean-text-to-keywords/infer_json_usage.py",
|
||||||
|
"--checkpoint", "pokemon_card_lora",
|
||||||
|
"--template", "clean-text-to-keywords/json_template_example.json",
|
||||||
|
"--generator-module", "card_generator_adapter.py",
|
||||||
|
"--device", "cuda",
|
||||||
|
"--save-path", "generated_card.png",
|
||||||
|
"--print-json",
|
||||||
]
|
]
|
||||||
|
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
@@ -116,7 +122,7 @@ if generate:
|
|||||||
st.warning("Veuillez entrer une description avant de générer.")
|
st.warning("Veuillez entrer une description avant de générer.")
|
||||||
else:
|
else:
|
||||||
with st.spinner("Génération de la carte Pokémon..."):
|
with st.spinner("Génération de la carte Pokémon..."):
|
||||||
image, logs = run_prompt_pipeline(raw_text)
|
image, logs, _cmd = run_prompt_pipeline(raw_text)
|
||||||
|
|
||||||
if image is not None:
|
if image is not None:
|
||||||
st.image(image, caption="Carte Pokémon générée", width="stretch")
|
st.image(image, caption="Carte Pokémon générée", width="stretch")
|
||||||
|
|||||||
Reference in New Issue
Block a user