forked from cgvr/DeltaVR
incorporate InvokeAI into start_pipeline.py
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import os
|
||||
import argparse
|
||||
import asyncio
|
||||
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from cloudflare_api import text_to_image, refine_text_prompt
|
||||
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
|
||||
|
||||
load_dotenv()
|
||||
@@ -17,7 +19,7 @@ def get_timestamp():
|
||||
return datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
||||
|
||||
|
||||
def main():
|
||||
async def main():
|
||||
parser = argparse.ArgumentParser(description="Text to 3D model pipeline")
|
||||
parser.add_argument("--prompt", type=str, required=True, help="User text prompt")
|
||||
args = parser.parse_args()
|
||||
@@ -35,13 +37,15 @@ def main():
|
||||
timestamp = get_timestamp()
|
||||
pipeline_folder = Path(PIPELINE_FOLDER)
|
||||
image_path = pipeline_folder / "images" / f"{timestamp}.jpg"
|
||||
text_to_image(image_generation_prompt, image_path)
|
||||
# TODO: use Invoke AI or Cloudflare, depending on env var
|
||||
#text_to_image_cloudflare(image_generation_prompt, image_path)
|
||||
await text_to_image_invoke_ai(image_generation_prompt, image_path)
|
||||
|
||||
print(f"Generated image file: {image_path}")
|
||||
model_path = pipeline_folder / "models" / timestamp
|
||||
model_file = image_to_3d_api(image_path, model_path)
|
||||
#model_file_path = model_path / "0" / "mesh.glb"
|
||||
print(f"Generated 3D model file: {model_file}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
asyncio.run(main())
|
||||
|
||||
Reference in New Issue
Block a user