|
|
|
|
|
def create_story_breakdown_prompt(user_idea, genre="sci-fi", mood="suspenseful", num_scenes=3): |
|
return f""" |
|
You are an expert screenwriter and visual storyteller. |
|
Based on the user's idea: "{user_idea}" |
|
And considering the genre: "{genre}" and mood: "{mood}" |
|
|
|
Generate a {num_scenes}-scene story breakdown. For each scene, provide: |
|
1. scene_number (int) |
|
2. setting_description (str): Vivid description of the location and atmosphere. |
|
3. characters_involved (list of str): Names of characters in the scene. |
|
4. key_action (str): The main event or action happening. |
|
5. dialogue_snippet (str): A brief, impactful line of dialogue if applicable. |
|
6. visual_style_suggestion (str): e.g., "Dark and gritty, high contrast, Blade Runner-esque neon" |
|
7. camera_angle_suggestion (str): e.g., "Low-angle shot to emphasize power" |
|
8. emotional_beat (str): The core emotion or turning point in the scene. |
|
|
|
Output ONLY the JSON object for the list of scenes. |
|
Example for one scene: |
|
{{ |
|
"scene_number": 1, |
|
"setting_description": "A dimly lit, cluttered spaceship cockpit. Warning lights flash intermittently.", |
|
"characters_involved": ["Captain Eva Rostova"], |
|
"key_action": "Eva notices an unusual energy signature on the main console.", |
|
"dialogue_snippet": "Eva: 'What in the void is that?'", |
|
"visual_style_suggestion": "Claustrophobic, practical lighting, lens flares.", |
|
"camera_angle_suggestion": "Close-up on Eva's face, then a point-of-view shot of the console.", |
|
"emotional_beat": "Curiosity mixed with apprehension." |
|
}} |
|
|
|
Provide the full JSON structure for {num_scenes} scenes in a list: |
|
[ |
|
{{scene1_details...}}, |
|
{{scene2_details...}}, |
|
... |
|
] |
|
""" |
|
|
|
def create_image_prompt_from_scene_data(scene_data, character_details=None, style_reference_desc=None): |
|
""" |
|
Generates an image prompt from structured scene data. |
|
scene_data: dictionary for a single scene. |
|
character_details: dict {char_name: description} for consistency (future use). |
|
style_reference_desc: textual description of a desired style (future use). |
|
""" |
|
base_desc = f"Scene {scene_data.get('scene_number', '')}: {scene_data.get('key_action', '')}. Setting: {scene_data.get('setting_description', '')}." |
|
visual_style = scene_data.get('visual_style_suggestion', 'cinematic') |
|
camera_angle = scene_data.get('camera_angle_suggestion', '') |
|
|
|
char_info = "" |
|
if character_details and scene_data.get('characters_involved'): |
|
for char_name in scene_data.get('characters_involved'): |
|
if char_name in character_details: |
|
char_info += f" {char_name} ({character_details[char_name]})." |
|
|
|
style_mod = "" |
|
if style_reference_desc: |
|
style_mod = f" Artistic style inspired by: {style_reference_desc}." |
|
|
|
full_prompt = f""" |
|
Generate a highly detailed, photorealistic image generation prompt. |
|
The image should depict: {base_desc}{char_info} |
|
Visual Style: {visual_style}{style_mod}. |
|
Camera Perspective: {camera_angle}. |
|
Emphasize mood: {scene_data.get('emotional_beat', '')}. |
|
Focus on cinematic composition, lighting. Suitable for DALL-E 3 or Midjourney. |
|
Output only the prompt string. |
|
""" |
|
return full_prompt.strip() |
|
|
|
|
|
def create_scene_regeneration_prompt(original_scene_data, user_feedback, full_story_context=None): |
|
""" |
|
Creates a prompt for Gemini to regenerate a specific scene's script details. |
|
original_scene_data: The JSON object of the scene to be modified. |
|
user_feedback: Text from the user describing desired changes. |
|
full_story_context: (Optional) JSON of all scenes for better consistency. |
|
""" |
|
context_str = f"Original scene details:\n{json.dumps(original_scene_data, indent=2)}\n\n" |
|
if full_story_context: |
|
context_str += f"Full story context (this scene is number {original_scene_data.get('scene_number')}):\n{json.dumps(full_story_context, indent=2)}\n\n" |
|
|
|
return f""" |
|
You are an expert script doctor. |
|
{context_str} |
|
The user wants to modify this scene based on the following feedback: "{user_feedback}" |
|
|
|
Please regenerate ONLY the JSON object for this single scene, incorporating the feedback. |
|
Maintain the same JSON structure as the original scene: |
|
(scene_number, setting_description, characters_involved, key_action, dialogue_snippet, visual_style_suggestion, camera_angle_suggestion, emotional_beat). |
|
Ensure the scene_number remains the same. |
|
Focus on making the changes impactful while keeping the scene coherent. |
|
If the feedback is about visual style or camera, update those fields accordingly. |
|
If the feedback is about action or dialogue, update those. |
|
""" |
|
|
|
def create_visual_regeneration_prompt(original_image_prompt, user_feedback_on_visuals, scene_data): |
|
""" |
|
Creates a prompt for Gemini to regenerate an image prompt based on feedback. |
|
""" |
|
return f""" |
|
The previous image prompt for a scene was: "{original_image_prompt}" |
|
The scene details are: |
|
Setting: {scene_data.get('setting_description')} |
|
Action: {scene_data.get('key_action')} |
|
Mood/Emotion: {scene_data.get('emotional_beat')} |
|
Visual Style: {scene_data.get('visual_style_suggestion')} |
|
Camera: {scene_data.get('camera_angle_suggestion')} |
|
|
|
The user provided this feedback on the visuals: "{user_feedback_on_visuals}" |
|
|
|
Generate a new, refined image generation prompt that incorporates this feedback. |
|
The new prompt should aim to correct or enhance the visuals as per the user's request. |
|
Output only the new prompt string. |
|
""" |
|
|
|
|
|
import json |