Skip to content

Instantly share code, notes, and snippets.

@sowbug
Last active September 2, 2022 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sowbug/b608c1d0eecc25de758800163d745528 to your computer and use it in GitHub Desktop.
Save sowbug/b608c1d0eecc25de758800163d745528 to your computer and use it in GitHub Desktop.
Stable Diffusion random prompt generator
#!/usr/bin/env python
import random
CONCEPTS = [
'baby',
'bacon',
'cabbage',
'cat',
'cauldron',
'combat',
'computer',
'dinosaur',
'dragon',
'droid',
'drone',
'flowers',
'flying saucer',
'frog',
'garden',
'ghosts',
'hovercraft',
'jellyfish',
'laser beam',
'mech',
'melee',
'moon',
'mushrooms',
'pcb',
'planet',
'princess',
'prisoner',
'puffer fish',
'radio dish',
'robot',
'samurai',
'satellite dish',
'shark',
'shrimp',
'skeleton',
'snake',
'spacecraft',
'spaceship',
'sunset',
'transistor',
'tree',
'vampires',
'witchcraft',
'woman',
'wreckage',
'zombies',
]
PLACES = [
'above the crowds',
'above the scene',
'afterlife',
'at a party',
'at a rave',
'at a rock concert',
'at burning man',
'cityscape',
'deep in the earth',
'from below',
'in a bedroom',
'in a car',
'in a forest',
'in a hospital',
'in a kitchen',
'in a laboratory',
'in a living room',
'in a meadow',
'in a restaurant',
'in a roller rink',
'in a spaceship',
'in bed',
'in hyperspace',
'in prison',
'in taipei',
'in the air',
'in the backyard',
'in the bathroom',
'in the clouds',
'in the desert',
'in the french quarter',
'in the jungle',
'in the matrix',
'in the metaverse',
'in the ocean',
'in the office',
'in the sand dunes',
'in the water',
'in times square',
'in virtual reality',
'moonscape',
'near the eiffel tower',
'near the great pyramids',
'on a city street',
'on a desert island',
'on a distant planet',
'on a golf course',
'on a train',
'on bourbon street',
'on the beach',
'on the roof',
'on the sidewalk',
'online',
'outer space',
'overhead',
'planetscape',
'shibuya crossing',
'tatooine',
'through the window',
'underground',
'underwater',
'while dreaming',
'while driving',
'while sleeping',
]
MODIFIERS = [
'100mm',
'1880',
'1950',
'1960',
'1970',
'1980',
'1990',
'2000',
'4k uhd',
'4k',
'8k uhd',
'8k',
'HQ',
'aerial view',
'album cover',
'analog photo',
'angelic',
'apocalyptic',
'arnold render',
'assembly instructions',
'award winning',
'bioluminescent details',
'bokeh',
'brightly lit',
'celestial',
'cgsociety',
'character design',
'cinematic lighting',
'color page',
'colorgrading',
'comic book',
'concept art',
'crystalline',
'decorations',
'depth of field',
'diffused lighting',
'digital art',
'digital painting',
'divine',
'dslr',
'eichler',
'ektachrome',
'electroluminescent',
'elegant',
'embellishments',
'evocative',
'featured on pixiv anime, manga',
'filigree',
'film photography',
'fire',
'foggy',
'global illumination',
'god rays',
'golden ratio',
'happy',
'hard shadows',
'houdini render',
'hyperrealism',
'hyperrealistic',
'in the distance',
'indirect light',
'insanely detailed',
'instagram',
'intricate',
'isometric',
'kitschy',
'landscape',
'low contrast',
'lumen reflections',
'luminescence',
'lush detail',
'lush',
'macro photography',
'magazine cover',
'massive scale',
'max detail',
'modern',
'muted colors',
'neon',
'octane render',
'oil painting',
'old photo',
'ornate',
'overglaze',
'overhead',
'panoramic',
'panoramic',
'perfectionism',
'phosphorescent',
'pixel art',
'polaroid',
'post-processing',
'precise lineart',
'quixel megascans',
'radiant light rays',
'rain',
'raytracing',
'retro',
'rim lighting',
'schematics',
'selfie',
'sharp focus',
'shiny',
'smooth',
'soft lighting',
'soft',
'specular lighting',
'spirals',
'steampunk',
'stereoscopic',
'storm',
'street level view',
'studio lighting',
'stunning environment',
'subsurface scattering',
'surreal',
'symmetry',
'tarot card',
'tendrils',
'tilt shift',
'tilted',
'tone mapping',
'translucency',
'trending on artstation',
'trending on dribbble',
'twinkling',
'ultra realistic',
'unreal engine',
'user manual',
'vibrant',
'vintage',
'vivid color',
'vivid',
'volumetric fog',
'volumetric lighting',
'vray',
'wide-angle',
]
TIMES = [
'nighttime',
'evening',
'morning',
'twilight',
'afternoon',
'dusk',
'daytime',
'noon',
'midnight',
]
STYLES = [
'art deco', 'rococo', 'art nouveau', 'baroque', 'Albrecht Dürer',
'Andy Warhol', 'Artemisia Gentileschi', 'Arthur Rackham', 'Banksy',
'Bob Eggleton', 'Boris Vallejo', 'Bruce Pennington', 'C. Foss',
'Caravaggio', 'Caspar David Friedrich', 'Chris Achilleos', 'Chris Moore',
'Ciruelo Cabral', 'Claude Monet', 'Danny Flynn', 'David A. Cherry',
'David A. Hardy', 'David B. Mattingly', 'David Hockney', 'Diego Rivera',
'Diego Velázquez', 'Don Maitz', 'Ed Emshwiller', 'Edgar Degas',
'Edvard Munch', 'Edward Hopper', 'El Greco', 'Eugene J. Paproski',
'Eugène Delacroix', 'Francis Bacon', 'Francisco Goya', 'Frank Frazetta',
'Frida Kahlo', 'Georges Seurat', 'Georgia O\'Keeffe', 'Gerhard Richter',
'Giotto', 'Graham Ingels', 'Grant Wood', 'Gustav Klimt',
'H. R. Van Dongen', 'H.R. Giger', 'Hector Garrido', 'Henri Matisse',
'Hovik Zohrabyan', 'J. Allen St. John', 'J. M. W. Turner',
'Jackson Pollock', 'Jacques-Louis David', 'James Abbott McNeill Whistler',
'Jan van Eyck', 'Jasper Johns', 'Jean Giraud', 'Jean-Antoine Watteau',
'Jean-Michel Basquiat', 'Jeff Easley', 'Jeffrey Catherine Jones',
'Jill Charuk', 'Jim Burns', 'Johan Messel', 'Johannes Vermeer',
'John Berkey', 'John Harris', 'John Jude Palencar', 'Kelly Freas',
'Ken Hong Leung', 'Leonardo da Vinci', 'Leonid Afremov', 'Linda Wilder',
'Liz Danforth', 'Marc Simonetti', 'Marc Simonetti and Martin Deschambault',
'Mark Rothko', 'Martin Deschambault', 'Mary Cassatt', 'Michael Hague',
'Michael Kaluta', 'Michael Whelan', 'Michelangelo', 'Mondrian',
'Nicolas Poussin', 'Noriyoshi Ohrai', 'Pablo Picasso', 'Pascal Blanchet',
'Patrick J. Jones', 'Patrick Nagel', 'Patrick Woodroffe', 'Paul Alexander',
'Paul Cézanne', 'Paul Gauguin', 'Paul Klee', 'Paul Youll',
'Peter Andrew Jones', 'Peter Elson', 'Peter Paul Rubens',
'Pierre-Auguste Renoir', 'Raphael', 'Rembrandt', 'René Magritte',
'Rodolfo Damaggio', 'Roger Dean', 'Ron Walotsky', 'Salvador Dalí',
'Sandro Botticelli', 'Shaun Tan', 'Simon Stålenhag', 'Stephan Martinière',
'Stephen Fabian', 'Stephen Hickman', 'Tsviatko Kinchev',
'Tzviatko Kinchev', 'Vincent Di Fate', 'Vincent Van Gogh', 'Wally Wood',
'Wassily Kandinsky', 'Wayne Barlowe', 'William Henrits', 'Yayoi Kusama',
'Yuri Petrenko', 'Édouard Manet'
]
for i in range(0, 20):
prompt = ''
prompt += ', '.join(random.sample(set(CONCEPTS), random.randrange(2, 4)))
prompt += ', ' + ', '.join(
random.sample(set(PLACES), random.randrange(2, 4)))
prompt += ', ' + ', '.join(
random.sample(set(MODIFIERS), random.randrange(2, 4)))
prompt += ', ' + ' '.join(random.sample(set(TIMES), 1))
prompt += ', in the style of ' + ' '.join(random.sample(set(STYLES), 1))
SEED = 42424242
print(
"python optimizedSD/optimized_txt2img.py --prompt \"%s\" --n_samples 8 --n_iter 1 --ddim_steps 100 --H 512 --W 832 --turbo --seed %d"
% (prompt, SEED))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment