amayer5125 is savage
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Example pipeline: OpenRouter photo enhancement (Darktable export → cloud edit)."""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from imagepipeline import Pipeline
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
ENV_FILE = REPO_ROOT / ".env"
|
||||
|
||||
# Change this to your Darktable export folder.
|
||||
INPUT = Path("/home/frank/tmp/aiedittest")
|
||||
|
||||
# Optional: where run folders are created (defaults to current working directory).
|
||||
OUTPUT_BASE = Path.home() / "pipeline_output"
|
||||
|
||||
OPENROUTER_PROMPT = (
|
||||
"Subtle photo enhancement only. Improve exposure, color, and skin tones. "
|
||||
"Sharpen where the blur seems to be unintended."
|
||||
"Keep the same people, poses, background, and composition. "
|
||||
"Natural, realistic look — no oversaturation or plastic skin."
|
||||
"Do not change image ratio, do not crop or enlarge the image, just improve the photo."
|
||||
"In group photos, improve the photo of the group, not the individual photos."
|
||||
"Also in group photos make faces same brightness and remove any glare or reflections."
|
||||
"Think of it like an amateur developed the RAW file in Lightroom and you are the senior who makes final touches to make it look professional."
|
||||
)
|
||||
|
||||
# Test cheap with Klein; switch to flux.2-pro or flux.2-max for final exports.
|
||||
OPENROUTER_MODEL = "x-ai/grok-imagine-image-quality"
|
||||
|
||||
|
||||
def _load_env_file(path: Path) -> None:
|
||||
if not path.is_file():
|
||||
return
|
||||
for raw_line in path.read_text(encoding="utf-8").splitlines():
|
||||
line = raw_line.strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
key, sep, value = line.partition("=")
|
||||
if not sep:
|
||||
continue
|
||||
key = key.strip()
|
||||
value = value.strip()
|
||||
if len(value) >= 2 and value[0] == value[-1] and value[0] in "\"'":
|
||||
value = value[1:-1]
|
||||
os.environ.setdefault(key, value)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
_load_env_file(ENV_FILE)
|
||||
|
||||
with Pipeline(
|
||||
name="example_ai",
|
||||
input_dir=INPUT,
|
||||
output_base=OUTPUT_BASE,
|
||||
) as p:
|
||||
p.step(
|
||||
"openrouter_edit",
|
||||
inputs="input",
|
||||
prompt=OPENROUTER_PROMPT,
|
||||
model=OPENROUTER_MODEL,
|
||||
max_edge=2048,
|
||||
)
|
||||
# Local CPU fallback (usually worse on already-graded Darktable exports):
|
||||
# exp = p.step("ai_exposure", inputs="input", max_edge=2048, strength=0.5)
|
||||
# p.step("ai_tone_map", inputs=exp, strength=0.5)
|
||||
output_root = p.run()
|
||||
|
||||
print(f"Pipeline finished. Output: {output_root}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user