Update engineers/deformes2D_thinker.py
Browse files- engineers/deformes2D_thinker.py +11 -15
engineers/deformes2D_thinker.py
CHANGED
|
@@ -2,12 +2,13 @@
|
|
| 2 |
#
|
| 3 |
# Copyright (C) August 4, 2025 Carlos Rodrigues dos Santos
|
| 4 |
#
|
| 5 |
-
# Version: 1.0.
|
| 6 |
#
|
| 7 |
# This file defines the Deformes2DThinker, the primary cognitive engine of the
|
| 8 |
# ADUC framework. It encapsulates all prompt engineering and creative decision-making
|
| 9 |
-
# logic
|
| 10 |
-
#
|
|
|
|
| 11 |
|
| 12 |
import logging
|
| 13 |
from pathlib import Path
|
|
@@ -40,7 +41,9 @@ class Deformes2DThinker:
|
|
| 40 |
storyboard_prompt = template.format(user_prompt=prompt, num_fragments=num_keyframes)
|
| 41 |
images = [Image.open(p) for p in ref_image_paths]
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
|
| 45 |
storyboard = storyboard_data.get("scene_storyboard", [])
|
| 46 |
if not storyboard or len(storyboard) != num_keyframes:
|
|
@@ -58,21 +61,14 @@ class Deformes2DThinker:
|
|
| 58 |
template = self._read_prompt_template("keyframe_selection_prompt.txt")
|
| 59 |
|
| 60 |
image_map = {f"IMG-{i+1}": path for i, path in enumerate(pool_image_paths)}
|
| 61 |
-
base_image_map = {f"BASE-{i+1}": path for i, path in enumerate(base_image_paths)}
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
]
|
| 67 |
|
| 68 |
storyboard_str = "\n".join([f"- Scene {i+1}: {s}" for i, s in enumerate(storyboard)])
|
| 69 |
selection_prompt = template.format(storyboard_str=storyboard_str, image_identifiers=list(image_map.keys()))
|
| 70 |
-
|
| 71 |
-
# The Gemini Manager expects a flat list of prompt parts
|
| 72 |
-
prompt_parts = []
|
| 73 |
-
for title, images in model_contents:
|
| 74 |
-
prompt_parts.append(title)
|
| 75 |
-
prompt_parts.extend(images)
|
| 76 |
prompt_parts.append(selection_prompt)
|
| 77 |
|
| 78 |
selection_data = gemini_manager_singleton.get_json_object(prompt_parts)
|
|
|
|
| 2 |
#
|
| 3 |
# Copyright (C) August 4, 2025 Carlos Rodrigues dos Santos
|
| 4 |
#
|
| 5 |
+
# Version: 1.0.1
|
| 6 |
#
|
| 7 |
# This file defines the Deformes2DThinker, the primary cognitive engine of the
|
| 8 |
# ADUC framework. It encapsulates all prompt engineering and creative decision-making
|
| 9 |
+
# logic. This version corrects the method calls to the GeminiManager, ensuring that
|
| 10 |
+
# all prompt components are assembled into a single list before being passed to the
|
| 11 |
+
# communication layer.
|
| 12 |
|
| 13 |
import logging
|
| 14 |
from pathlib import Path
|
|
|
|
| 41 |
storyboard_prompt = template.format(user_prompt=prompt, num_fragments=num_keyframes)
|
| 42 |
images = [Image.open(p) for p in ref_image_paths]
|
| 43 |
|
| 44 |
+
# Assemble all parts into a single list for the manager
|
| 45 |
+
prompt_parts = [storyboard_prompt] + images
|
| 46 |
+
storyboard_data = gemini_manager_singleton.get_json_object(prompt_parts)
|
| 47 |
|
| 48 |
storyboard = storyboard_data.get("scene_storyboard", [])
|
| 49 |
if not storyboard or len(storyboard) != num_keyframes:
|
|
|
|
| 61 |
template = self._read_prompt_template("keyframe_selection_prompt.txt")
|
| 62 |
|
| 63 |
image_map = {f"IMG-{i+1}": path for i, path in enumerate(pool_image_paths)}
|
|
|
|
| 64 |
|
| 65 |
+
prompt_parts = ["# Reference Images (Story Base)"]
|
| 66 |
+
prompt_parts.extend([Image.open(p) for p in base_image_paths])
|
| 67 |
+
prompt_parts.append("\n# Image Pool (Scene Bank)")
|
| 68 |
+
prompt_parts.extend([Image.open(p) for p in pool_image_paths])
|
| 69 |
|
| 70 |
storyboard_str = "\n".join([f"- Scene {i+1}: {s}" for i, s in enumerate(storyboard)])
|
| 71 |
selection_prompt = template.format(storyboard_str=storyboard_str, image_identifiers=list(image_map.keys()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
prompt_parts.append(selection_prompt)
|
| 73 |
|
| 74 |
selection_data = gemini_manager_singleton.get_json_object(prompt_parts)
|