diff --git a/3d-generation-pipeline/images/2025-10-20-16-24-45.jpg b/3d-generation-pipeline/images/2025-10-20-16-24-45.jpg new file mode 100644 index 00000000..4738b383 --- /dev/null +++ b/3d-generation-pipeline/images/2025-10-20-16-24-45.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63f5fed91bb2310f57d8483e6e05c5971d968918c2640581e96603e606720b17 +size 589929 diff --git a/3d-generation-pipeline/images/2025-10-20-16-32-50.jpg b/3d-generation-pipeline/images/2025-10-20-16-32-50.jpg new file mode 100644 index 00000000..a69473cc --- /dev/null +++ b/3d-generation-pipeline/images/2025-10-20-16-32-50.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ca36f0e17e461b5597a56bbf5b8e59f5d307bdb734f589c5b2e3da62d95599e +size 453587 diff --git a/3d-generation-pipeline/models/2025-10-20-16-32-50/0/input.png b/3d-generation-pipeline/models/2025-10-20-16-32-50/0/input.png new file mode 100644 index 00000000..cd6aa9be --- /dev/null +++ b/3d-generation-pipeline/models/2025-10-20-16-32-50/0/input.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4af3b5f3aec88fbde550b361c69c7ee57db212058c90b20c10693933229c2d99 +size 531044 diff --git a/3d-generation-pipeline/models/2025-10-20-16-32-50/0/mesh.glb b/3d-generation-pipeline/models/2025-10-20-16-32-50/0/mesh.glb new file mode 100644 index 00000000..ba66d97b Binary files /dev/null and b/3d-generation-pipeline/models/2025-10-20-16-32-50/0/mesh.glb differ diff --git a/3d-generation-pipeline/start_pipeline.py b/3d-generation-pipeline/start_pipeline.py index 9e2ab9b9..46c6c123 100644 --- a/3d-generation-pipeline/start_pipeline.py +++ b/3d-generation-pipeline/start_pipeline.py @@ -2,6 +2,7 @@ import os import base64 import requests import argparse +from pathlib import Path from datetime import datetime from dotenv import load_dotenv @@ -15,7 +16,7 @@ def get_timestamp(): return datetime.now().strftime("%Y-%m-%d-%H-%M-%S") -def text_to_image(prompt, output_name): +def text_to_image(prompt, output_path): MODEL = "@cf/black-forest-labs/flux-1-schnell" URL = f"https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/run/{MODEL}" @@ -38,11 +39,9 @@ def text_to_image(prompt, output_name): img_bytes = base64.b64decode(b64) - out_path = f"images/{output_name}.jpg" - with open(out_path, "wb") as f: + with open(output_path, "wb") as f: f.write(img_bytes) - return out_path def refine_text_prompt(prompt): MODEL = "@cf/meta/llama-3.2-3b-instruct" @@ -70,7 +69,8 @@ def refine_text_prompt(prompt): def image_to_3d(image_path, output_path): import subprocess - MODEL_FOLDER = r"D:\users\henrisel\stable-fast-3d" + # TODO: make this configurable + MODEL_FOLDER = r"D:\henrisel\AI-models\stable-fast-3d" venv_python = MODEL_FOLDER + r"\.venv\Scripts\python.exe" script_path = MODEL_FOLDER + r"\run.py" @@ -99,11 +99,13 @@ def main(): print(f"User prompt: {user_prompt}") refined_prompt = refine_text_prompt(user_prompt) print(f"Refined prompt: {refined_prompt}") - image_path = text_to_image(refined_prompt, get_timestamp()) + timestamp = get_timestamp() + image_path = Path.cwd() / "images" / f"{timestamp}.jpg" + text_to_image(refined_prompt, image_path) print(f"Generated image file: {image_path}") - output_path = r"\models" - image_to_3d(image_path, output_path) - print(f"Generated 3D model file: {output_path}") + model_path = Path.cwd() / "models" / timestamp + image_to_3d(image_path, model_path) + print(f"Generated 3D model file: {model_path}") if __name__ == "__main__":