Spaces:
Paused
Paused
Update utils/planner.py
Browse filesexttracting multiple prompts
- utils/planner.py +16 -0
utils/planner.py
CHANGED
|
@@ -44,3 +44,19 @@ def extract_scene_plan(prompt: str) -> dict:
|
|
| 44 |
"layout": {},
|
| 45 |
"rules": {}
|
| 46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
"layout": {},
|
| 45 |
"rules": {}
|
| 46 |
}
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
# ----------------------------
|
| 50 |
+
# 🧠 Generate Prompt Variations from Scene Plan
|
| 51 |
+
# ----------------------------
|
| 52 |
+
def generate_prompt_variations(base_prompt: str, scene_plan: dict, num_variations: int) -> list:
|
| 53 |
+
variations = []
|
| 54 |
+
scene = scene_plan.get("scene", {})
|
| 55 |
+
subject = scene_plan.get("subject", {})
|
| 56 |
+
layout = scene_plan.get("layout", {})
|
| 57 |
+
|
| 58 |
+
for i in range(num_variations):
|
| 59 |
+
enriched = f"{base_prompt}, in a {scene.get('environment', '')} setting with {scene.get('setting', '')}, featuring {subject.get('main_actor', '')}, layout includes {layout.get('foreground', '')} in foreground and {layout.get('background', '')} in background, style variation {i+1}"
|
| 60 |
+
variations.append(enriched.strip())
|
| 61 |
+
|
| 62 |
+
return variations
|