clean up code + prompt engineering for image generation
This commit is contained in:
parent
191c9e66fe
commit
34a6c50598
@ -1,8 +1,5 @@
|
||||
PIPELINE_FOLDER=
|
||||
REFINE_PROMPT=0
|
||||
3D_GENERATION_URL=
|
||||
MODEL_FOLDER=
|
||||
|
||||
CLOUDFLARE_ACCOUNT_ID=
|
||||
CLOUDFLARE_API_TOKEN=
|
||||
|
||||
3D_GENERATION_URL=
|
||||
MODEL_FOLDER=
|
||||
|
||||
@ -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}")
|
||||
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"
|
||||
|
||||
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
|
||||
|
||||
pipeline_folder = Path(PIPELINE_FOLDER)
|
||||
pipeline_folder = Path(__file__).resolve().parent
|
||||
timestamp = get_timestamp()
|
||||
setup_logger(pipeline_folder, timestamp)
|
||||
time_checkpoint = time.time()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user