From 34a6c505983718a736cf7b104331e6dfdf7f126d Mon Sep 17 00:00:00 2001 From: henrisel Date: Fri, 21 Nov 2025 11:39:36 +0200 Subject: [PATCH] clean up code + prompt engineering for image generation --- 3d-generation-pipeline/.env.example | 9 +++------ 3d-generation-pipeline/start_pipeline.py | 17 +++-------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/3d-generation-pipeline/.env.example b/3d-generation-pipeline/.env.example index d52fb845..976f48cb 100644 --- a/3d-generation-pipeline/.env.example +++ b/3d-generation-pipeline/.env.example @@ -1,8 +1,5 @@ -PIPELINE_FOLDER= -REFINE_PROMPT=0 - -CLOUDFLARE_ACCOUNT_ID= -CLOUDFLARE_API_TOKEN= - 3D_GENERATION_URL= MODEL_FOLDER= + +CLOUDFLARE_ACCOUNT_ID= +CLOUDFLARE_API_TOKEN= \ No newline at end of file diff --git a/3d-generation-pipeline/start_pipeline.py b/3d-generation-pipeline/start_pipeline.py index b590adb0..78293ed7 100644 --- a/3d-generation-pipeline/start_pipeline.py +++ b/3d-generation-pipeline/start_pipeline.py @@ -1,4 +1,3 @@ -import os import argparse import asyncio import logging @@ -8,14 +7,11 @@ from pathlib import Path from datetime import datetime from dotenv import load_dotenv -from cloudflare_api import text_to_image_cloudflare, refine_text_prompt from generate_image_local import text_to_image_invoke_ai -from generate_model_local import image_to_3d_api, image_to_3d_subprocess +from generate_model_local import image_to_3d_api load_dotenv() -PIPELINE_FOLDER = os.environ["PIPELINE_FOLDER"] - def get_timestamp(): return datetime.now().strftime("%Y-%m-%d-%H-%M-%S") @@ -26,7 +22,6 @@ def setup_logger(base_folder, timestamp): logging.basicConfig( filename=log_dir / f"{timestamp}.log", level=logging.INFO, - #format='%(asctime)s - %(message)s' force=True ) @@ -38,15 +33,9 @@ async def main(): input_prompt = args.prompt print(f"Input prompt: {input_prompt}") - - refine_prompt = os.environ["REFINE_PROMPT"] == "1" - if refine_prompt: - image_generation_prompt = refine_text_prompt(input_prompt) - print(f"Refined prompt: {image_generation_prompt}") - else: - image_generation_prompt = input_prompt + image_generation_prompt = input_prompt + ", single object, plain neutral background, high-resolution, sharp details, soft studio lighting, front and side visible, realistic style, true-to-scale" - pipeline_folder = Path(PIPELINE_FOLDER) + pipeline_folder = Path(__file__).resolve().parent timestamp = get_timestamp() setup_logger(pipeline_folder, timestamp) time_checkpoint = time.time()