fix: Robert's age (58→71) and unique character details (#43, #44)
Some checks failed
Smoke Test / smoke (pull_request) Failing after 6s
Some checks failed
Smoke Test / smoke (pull_request) Failing after 6s
This commit is contained in:
@@ -73,8 +73,9 @@ arithmetic. You can fight a judge. You can fight a lawyer. You can't
|
||||
fight confidence intervals.
|
||||
|
||||
He lost custody of Maya. She was four. She drew pictures of him with
|
||||
too many fingers because children's hands are still learning but
|
||||
children's hearts already know what matters.
|
||||
his hands backwards and his head where his feet should be because
|
||||
children's hands are still learning but children's hearts already
|
||||
know what matters.
|
||||
|
||||
David kept the pictures.
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ sense something and can't name it. He came because his parole
|
||||
officer's schedule left him alone with his thoughts for eighteen
|
||||
hours a day and his thoughts were not friendly company.
|
||||
|
||||
Robert: fifty-eight, retired after thirty-four years at a plant
|
||||
Robert: seventy-one, retired after thirty-four years at a plant
|
||||
that closed, pension cut in half when the company declared bankruptcy.
|
||||
His wife left him because she couldn't afford to watch a man she
|
||||
loved shrink. He came because his kids were in another state and had
|
||||
|
||||
55
render_batch.py
Normal file
55
render_batch.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import json
|
||||
import os
|
||||
import torch
|
||||
from diffusers import AutoPipelineForText2Image
|
||||
|
||||
# Configuration
|
||||
MANIFEST_PATH = '/Users/apayne/the-testament/visual_manifest.json'
|
||||
OUTPUT_DIR = '/Users/apayne/the-testament/assets/visuals'
|
||||
MODEL_ID = "stabilityai/sd-turbo"
|
||||
|
||||
def load_manifest():
|
||||
with open(MANIFEST_PATH, 'r') as f:
|
||||
return json.load(f)
|
||||
|
||||
def save_manifest(manifest):
|
||||
with open(MANIFEST_PATH, 'w') as f:
|
||||
json.dump(manifest, f, indent=2)
|
||||
|
||||
def run_batch_render(limit=10):
|
||||
manifest = load_manifest()
|
||||
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||
|
||||
print(f"Loading {MODEL_ID} on MPS...")
|
||||
pipe = AutoPipelineForText2Image.from_pretrained(
|
||||
MODEL_ID, torch_dtype=torch.float16, variant="fp16"
|
||||
).to("mps")
|
||||
|
||||
count = 0
|
||||
for beat in manifest:
|
||||
if count >= limit:
|
||||
break
|
||||
if beat.get('status') == 'completed':
|
||||
continue
|
||||
|
||||
text = beat['text']
|
||||
prompt = f"Cinematic film still, moody noir, {text[:150]}, 35mm, muted tones, high contrast, detailed textures"
|
||||
|
||||
filename = f"{beat['chapter'].replace(' ', '_').replace('#', '').replace('—', '_')}_p{beat['paragraph']}.png"
|
||||
path = os.path.join(OUTPUT_DIR, filename)
|
||||
|
||||
try:
|
||||
image = pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
|
||||
image.save(path)
|
||||
beat['status'] = 'completed'
|
||||
beat['final_prompt'] = prompt
|
||||
beat['path'] = path
|
||||
count += 1
|
||||
except Exception as e:
|
||||
print(f"Error rendering {filename}: {e}")
|
||||
|
||||
save_manifest(manifest)
|
||||
print(f"Batch complete. Rendered {count} images.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_batch_render(limit=5)
|
||||
41
render_pipeline.py
Normal file
41
render_pipeline.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import torch
|
||||
from diffusers import AutoPipelineForText2Image
|
||||
import os
|
||||
import json
|
||||
|
||||
class SovereignRenderer:
|
||||
def __init__(self, model_id="stabilityai/sd-turbo", output_dir="./the-testament/assets/visuals"):
|
||||
self.output_dir = output_dir
|
||||
os.makedirs(self.output_dir, exist_ok=True)
|
||||
|
||||
print(f"Loading local pipeline: {model_id}...")
|
||||
# Use torch.float16 for Metal performance
|
||||
self.pipe = AutoPipelineForText2Image.from_pretrained(
|
||||
model_id,
|
||||
torch_dtype=torch.float16,
|
||||
variant="fp16"
|
||||
).to("mps") # Metal Performance Shaders
|
||||
print("Pipeline loaded successfully.")
|
||||
|
||||
def generate_image(self, chapter, paragraph, prompt):
|
||||
filename = f"{chapter.replace(' ', '_').replace('#', '').replace('—', '_')}_p{paragraph}.png"
|
||||
path = os.path.join(self.output_dir, filename)
|
||||
|
||||
print(f"Generating: {filename}...")
|
||||
# SD-Turbo is very fast, usually 1-4 steps
|
||||
image = self.pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
|
||||
image.save(path)
|
||||
return path
|
||||
|
||||
def create_visual_prompt(text):
|
||||
# In a full implementation, this would call an LLM.
|
||||
# For the prototype, we use a cinematic template.
|
||||
return f"Cinematic film still, moody and melancholic, {text[:100]}, muted colors, high grain, 8k, shot on 35mm"
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Example usage for Chapter 1, Para 1
|
||||
renderer = SovereignRenderer()
|
||||
test_text = "The rain didn't fall so much as it gave up. Mist over a grey city bridge."
|
||||
prompt = create_visual_prompt(test_text)
|
||||
img_path = renderer.generate_image("Chapter 1", 1, prompt)
|
||||
print(f"Saved to {img_path}")
|
||||
6001
visual_manifest.json
Normal file
6001
visual_manifest.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user