Skip to content

Conversation

@anthonywu
Copy link
Collaborator

Taking something from my personal workflow to share as a tool.

It's not quite worth creating a library for, and also introduces a lot of dspy dependencies that I think do not belong in mflux, so a uv runnable script is perfect IMO.

Usage

  1. Users should copy/paste the code sample into their Python workflows and tweak model and Signature until it meets their needs
  2. Can use the tool as-is on the CLI to be the --prompt-file arg. Using --prompt not recommended due to JSON character escape issues in terminals.

dspy_photorealistic_prompt.py "a cat wearing sunglasses lounging at a beach chair" > /tmp/cat_prompt.txt

mflux-generate --prompt-file /tmp/cat_prompt.txt --model schnell --steps 10

image

Demo

Using the tool CLI without args will just run some examples:

./dspy_photorealistic_prompt.py
No prompt provided. This program will now show you 5 examples.
Generating speed varies by the capabilities of your hardware.
You may need to be patient as the results stream in.
                                        Prompt Enhancement Examples
                                           ╷
                           Original Prompt │ Enhanced Prompt
 ══════════════════════════════════════════╪══════════════════════════════════════════════════════════════
          iPhone macro photo of a plate of │ {
                     high-end Italian food │     "camera_model": "iPhone",
                                           │     "camera_type": "Digital",
                                           │     "resolution": "highres",
                                           │     "lens": "Macro",
                                           │     "shot_angle": "Eye-level shot",
                                           │     "pose": "Close-up",
                                           │     "focus": "Foreground focus",
                                           │     "f_stop": "f/2.8",
                                           │     "shutter_speed": "1/60s",
                                           │     "iso": "ISO 100",
                                           │     "lighting": "Natural light",
                                           │     "color_style": "Vibrant",
                                           │     "film_stock": null,
                                           │     "overall_mood": "Joyful",
                                           │     "trigger_words": "dspy demo",
                                           │     "description": "iPhone macro photo of a plate of
                                           │ high-end Italian food"
                                           │ }
   DSLR Telephoto of a climber celebrating │ {
    at the summit of Yosemite's El Capitan │     "camera_model": "Canon",
                                           │     "camera_type": "Digital",
                                           │     "resolution": "highres",
                                           │     "lens": "Telephoto",
                                           │     "shot_angle": "Eye-level shot",
                                           │     "pose": "Standing",
                                           │     "focus": "Foreground focus",
                                           │     "f_stop": "f/5.6",
                                           │     "shutter_speed": "1/250s",
                                           │     "iso": "ISO 100",
                                           │     "lighting": "Natural light",
                                           │     "color_style": "Vibrant",
                                           │     "film_stock": null,
                                           │     "overall_mood": "Joyful",
                                           │     "trigger_words": "dspy demo",
                                           │     "description": "DSLR Telephoto of a climber celebrating
                                           │ at the summit of Yosemite's El Capitan"
                                           │ }
  In a dark room, a cat pounces on a laser │ {
                                   pointer │     "camera_model": "iPhone",
                                           │     "camera_type": "Digital",
                                           │     "resolution": "highres",
                                           │     "lens": "50mm",
                                           │     "shot_angle": "Eye-level shot",
                                           │     "pose": "Action shot",
                                           │     "focus": "Foreground focus",
                                           │     "f_stop": "f/2.8",
                                           │     "shutter_speed": "1/1000s",
                                           │     "iso": "ISO 800",
                                           │     "lighting": "Ambient light",
                                           │     "color_style": "Vibrant",
                                           │     "film_stock": null,
                                           │     "overall_mood": "Energetic",
                                           │     "trigger_words": "dspy demo",
                                           │     "description": "In a dark room, a cat pounces on a laser
                                           │ pointer"
                                           │ }
  Wide angle lens, Birds eye view of a dog │ {
    lying supine on the lawn with its paws │     "camera_model": "iPhone",
                                        up │     "camera_type": "Digital",
                                           │     "resolution": "highres",
                                           │     "lens": "Wide-angle",
                                           │     "shot_angle": "Bird's-eye view",
                                           │     "pose": "Supine",
                                           │     "focus": "Deep focus",
                                           │     "f_stop": "f/2.8",
                                           │     "shutter_speed": "1/250s",
                                           │     "iso": "ISO 400",
                                           │     "lighting": "Natural light",
                                           │     "color_style": "Vibrant",
                                           │     "film_stock": null,
                                           │     "overall_mood": "Serene",
                                           │     "trigger_words": "dspy demo",
                                           │     "description": "Wide angle lens, Birds eye view of a dog
                                           │ lying supine on the lawn with its paws up"
                                           │ }
  Canon DSLR, studio backdrop, High school │ {
     yearbook portrait of a athletic track │     "camera_model": "Canon",
        and field runner sporting his team │     "camera_type": "Digital",
                                    jacket │     "resolution": "highres",
                                           │     "lens": "Prime lens",
                                           │     "shot_angle": "Eye-level shot",
                                           │     "pose": "Portrait",
                                           │     "focus": "Deep focus",
                                           │     "f_stop": "f/2.8",
                                           │     "shutter_speed": "1/250s",
                                           │     "iso": "ISO 100",
                                           │     "lighting": "Studio light",
                                           │     "color_style": "Cinematic teal and orange",
                                           │     "film_stock": null,
                                           │     "overall_mood": "Nostalgic",
                                           │     "trigger_words": "dspy demo",
                                           │     "description": "Canon DSLR, studio backdrop, High school
                                           │ yearbook portrait of a athletic track and field runner
                                           │ sporting his team jacket"
                                           │ }
                                           ╵

Comment on lines +162 to +166
"iPhone macro photo of a plate of high-end Italian food",
"DSLR Telephoto of a climber celebrating at the summit of Yosemite's El Capitan",
"In a dark room, a cat pounces on a laser pointer",
"Wide angle lens, Birds eye view of a dog lying supine on the lawn with its paws up",
"Canon DSLR, studio backdrop, High school yearbook portrait of a athletic track and field runner sporting his team jacket",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, you still have to be more specific than this to get exactly what you want, I'm just demonstrating that even at this low effort, you can get a lot better than plain text prompts!

@anthonywu anthonywu mentioned this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant