Merge pull request #4 from AIrjen/Improvements-in-prompt-engine

improvements
This commit is contained in:
AIrjen
2023-04-10 21:48:52 +02:00
committed by GitHub
24 changed files with 134 additions and 36 deletions
+2
View File
@@ -0,0 +1,2 @@
*.pyc
+36 -7
View File
@@ -14,6 +14,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artistmode = "
completeprompt = " "
isphoto = 0
othertype = 0
humanspecial = 0
wereanimaladded = 0
@@ -134,16 +135,18 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artistmode = "
if(mainchooser in ["object", "animal", "humanoid", "concept"] and othertype == 0 and "portait" not in completeprompt):
completeprompt = add_from_csv(completeprompt, "shotsizes", 0, ""," of a ")
elif("portait" in completeprompt):
completeprompt += " of a "
completeprompt += " ,close up of a "
# Multiple subjects doesnt really work, need to think of other way to do multiple subjects. Maybe AND in the prompt?
# if(subjectchooser in ["object", "animal", "humanoid"] and rare_dist(insanitylevel)):
# completeprompt = completeprompt[:-2] # remove a from
# completeprompt = add_from_csv(completeprompt, "amounts", 0, "","")
# Common to have 1 description, uncommon to have 2
if(common_dist(insanitylevel)):
completeprompt = add_from_csv(completeprompt, "descriptors", 0, "","")
if(normal_dist(insanitylevel)):
if(uncommon_dist(insanitylevel)):
completeprompt = add_from_csv(completeprompt, "descriptors", 0, "","")
if(subjectchooser in ["animal as human,","human", "job", "fictional", "non fictional", "humanoid"] and normal_dist(insanitylevel)):
@@ -271,7 +274,7 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artistmode = "
# riding an animal, holding an object or driving a vehicle, rare
if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid"] and rare_dist(insanitylevel)):
humanspecial = 1
speciallist = ["riding a -animal- ", "holding a -object- ", "driving a -vehicle-", "visiting a -building-"]
speciallist = [" riding a -animal- ", "holding a -object- ", " driving a -vehicle-", " visiting a -building-"]
completeprompt += random.choice(speciallist)
# SD understands emoji's. Can be used to manipulate facial expressions.
@@ -324,16 +327,33 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artistmode = "
if(subjectchooser in ["animal as human,","human","fictional", "non fictional", "humanoid"] and normal_dist(insanitylevel)):
completeprompt = add_from_csv(completeprompt, "accessories", 1, "","")
# Sometimes get 2
if(uncommon_dist(insanitylevel)):
completeprompt = add_from_csv(completeprompt, "accessories", 1, "","")
if(subjectchooser not in ["landscape", "concept"] and normal_dist(insanitylevel)):
completeprompt = add_from_csv(completeprompt, "locations", 1, " background is ","")
if(subjectchooser not in ["landscape", "concept"] and humanspecial != 1 and normal_dist(insanitylevel)):
backgroundtype = ["landscape", "buildingbackground", "insidebuilding"]
match random.choice(backgroundtype):
case "landscape":
completeprompt = add_from_csv(completeprompt, "locations", 1, " background is ","")
case "buildingbackground":
completeprompt = ",background is "
if(uncommon_dist(insanitylevel)):
completeprompt = add_from_csv(completeprompt, "descriptors", 0, "","")
completeprompt = add_from_csv(completeprompt, "buildings", 0, "","")
case "insidebuilding":
completeprompt = ",inside a "
if(uncommon_dist(insanitylevel)):
completeprompt = add_from_csv(completeprompt, "descriptors", 0, "","")
completeprompt = add_from_csv(completeprompt, "buildings", 0, "","")
if(normal_dist(insanitylevel)):
# landscapes it is nice to always have a time period
if(normal_dist(insanitylevel) or subjectchooser=="landscape"):
completeprompt = add_from_csv(completeprompt, "timeperiods", 1, "","")
if(mainchooser not in ["landscape"] and normal_dist(insanitylevel)):
@@ -352,7 +372,16 @@ def build_dynamic_prompt(insanitylevel = 5, forcesubject = "all", artistmode = "
if(normal_dist(insanitylevel)):
completeprompt = add_from_csv(completeprompt, "lighting", 1, "","")
if(normal_dist(insanitylevel)):
# determine wether we have a photo or not
if("hoto" in completeprompt):
isphoto = 1
if(common_dist(insanitylevel)):
completeprompt += ", film grain"
if(isphoto == 1):
completeprompt = add_from_csv(completeprompt, "cameras", 1, "","")
if(normal_dist(insanitylevel) or isphoto == 1):
completeprompt = add_from_csv(completeprompt, "lenses", 1, "","")
if(normal_dist(insanitylevel)):
+6 -1
View File
@@ -88,4 +88,9 @@ Freckles
Medallion
Crown
Tiara
Mask made out of -material-
Mask made out of -material-
angelic halo
wrinkles
pores
Makeup
No makeup
1 Glasses
88 Medallion
89 Crown
90 Tiara
91 Mask made out of -material-
92 angelic halo
93 wrinkles
94 pores
95 Makeup
96 No makeup
+1 -1
View File
@@ -30,7 +30,7 @@ Skyscraper
Tower
Shopping mall
Department store
Supermarket
Market
Grocery store
Convenience store
Restaurant
1 Archticture
30 Tower
31 Shopping mall
32 Department store
33 Supermarket Market
34 Grocery store
35 Convenience store
36 Restaurant
+22
View File
@@ -0,0 +1,22 @@
Fujifilm XT3
Canon 5d mark 4
Nikon d3300
Canon eos 5d mark 4
Sony A7
Nikon d850
Phase One XF IQ4 150MP
Nikon Z9
Iphone X
Samsung Galaxy
compact camera
film camera
Polaroid
Kodak portra 400
Kodak portra 800
Canon RF
Canon EF
Canon R5
Hasselblad
Kodak gold 200
Nikon d850
Sony A9 II
1 Fujifilm XT3
2 Canon 5d mark 4
3 Nikon d3300
4 Canon eos 5d mark 4
5 Sony A7
6 Nikon d850
7 Phase One XF IQ4 150MP
8 Nikon Z9
9 Iphone X
10 Samsung Galaxy
11 compact camera
12 film camera
13 Polaroid
14 Kodak portra 400
15 Kodak portra 800
16 Canon RF
17 Canon EF
18 Canon R5
19 Hasselblad
20 Kodak gold 200
21 Nikon d850
22 Sony A9 II
+1
View File
@@ -32,6 +32,7 @@ Colorful
Colorless
Vivid
Vibrant
Neutral
Iridescent
Neon
Lime green
1 Red
32 Colorless
33 Vivid
34 Vibrant
35 Neutral
36 Iridescent
37 Neon
38 Lime green
+2 -1
View File
@@ -55,4 +55,5 @@ Vivid colors
-color- neon hue
-color- and -color- hue
-color- and -color- neon hue
-color- color grading
-color- color grading
psychedelic colors
1 Agfacolor
55 -color- neon hue
56 -color- and -color- hue
57 -color- and -color- neon hue
58 -color- color grading
59 psychedelic colors
+6 -1
View File
@@ -323,4 +323,9 @@ Cartoony
1800's
1700's
1600's
Luminescent
Luminescent
Floating
Shiny
Chibi
Anime
Verdant
1 Handsome
323 1800's
324 1700's
325 1600's
326 Luminescent
327 Floating
328 Shiny
329 Chibi
330 Anime
331 Verdant
+1
View File
@@ -8,4 +8,5 @@ Caramel
Honey
Platinum
Gray
Bald
-color-
1 Black
8 Honey
9 Platinum
10 Gray
11 Bald
12 -color-
+2 -3
View File
@@ -1,7 +1,5 @@
RAW photo
Photograph
Polaroid
Fujifilm
Color splash
Digital artwork
Digital art
@@ -33,4 +31,5 @@ Unreal Engine
VRay
Abstract
Fractal
Portait
Portait
Raw digital photo
1 RAW photo
2 Photograph
Polaroid
Fujifilm
3 Color splash
4 Digital artwork
5 Digital art
31 VRay
32 Abstract
33 Fractal
34 Portait
35 Raw digital photo
+3 -1
View File
@@ -353,4 +353,6 @@ Count
Countess
Baron
Baroness
Nobleman
Nobleman
Vizier
Sultan
1 Pirate
353 Countess
354 Baron
355 Baroness
356 Nobleman
357 Vizier
358 Sultan
+5 -2
View File
@@ -1,7 +1,9 @@
overhead angle
Zoom lens
Depth of field 100mm
Depth of field 270mm
80mm
50mm
35mm
F/1.8
F/2.8
F/5
@@ -13,4 +15,5 @@ Selective focus
Fish-eye Lens
telephoto lens
800mm lens
macro lens
macro lens
L USM
1 overhead angle Zoom lens
overhead angle
1 Zoom lens Zoom lens
2 Depth of field 100mm Depth of field 100mm
3 Depth of field 270mm Depth of field 270mm
4 80mm
5 50mm
6 35mm
7 F/1.8 F/1.8
8 F/2.8 F/2.8
9 F/5 F/5
15 Fish-eye Lens Fish-eye Lens
16 telephoto lens telephoto lens
17 800mm lens 800mm lens
18 macro lens macro lens
19 L USM
+3 -1
View File
@@ -653,4 +653,6 @@ Riften
Stormwind
Orgrimmar
Ironforge
Tristram
Tristram
cityscape
paradise
1 Grand Canyon
653 Stormwind
654 Orgrimmar
655 Ironforge
656 Tristram
657 cityscape
658 paradise
+4 -1
View File
@@ -103,4 +103,7 @@ Titanium
Brass
Gems
Crystal
Emerald
Emerald
Wires
Plating
Fabric
1 Wood
103 Brass
104 Gems
105 Crystal
106 Emerald
107 Wires
108 Plating
109 Fabric
+1
View File
@@ -115,6 +115,7 @@ Anne Hathaway
Natalie Portman
Mila Kunis
Emma Stone
Anya Taylor-Joy
Keira Knightley
Julianne Moore
Viola Davis
1 Tom Hanks
115 Natalie Portman
116 Mila Kunis
117 Emma Stone
118 Anya Taylor-Joy
119 Keira Knightley
120 Julianne Moore
121 Viola Davis
+2 -1
View File
@@ -377,4 +377,5 @@ Marigolds
-object- in a bottle
Cup of Coffee
Cup of Tea
Faberge egg
Faberge egg
Quilt
1 Pen
377 -object- in a bottle
378 Cup of Coffee
379 Cup of Tea
380 Faberge egg
381 Quilt
+6 -1
View File
@@ -68,4 +68,9 @@ Playing card
Fantasy concept art
Cartoon
Mixed media
Cover Art
Cover Art
Historical Photo
Associated press photo
editorial illustration
digital sculpture made of -material-
Fashion shoot
1 Concept sheet
68 Fantasy concept art
69 Cartoon
70 Mixed media
71 Cover Art
72 Historical Photo
73 Associated press photo
74 editorial illustration
75 digital sculpture made of -material-
76 Fashion shoot
+9 -8
View File
@@ -90,14 +90,14 @@ Athletic shorts
Bermudas
High-waisted shorts
Low-waisted shorts
Playsuits
Overalls
Blazers
Cardigans
Hoodies
Sweatshirts
T-shirts
Tank tops
Playsuit
Overall
Blazer
Cardigan
Hoodie
Sweatshirt
T-shirt
Tank top
High-waisted pants and crop top
Maxi skirt and tank top
Blazer and jeans
@@ -194,6 +194,7 @@ Nightshirt and leggings
Satin or silk chemise
Babydoll
Kimono
Wedding dress
Sari
Hanbok
Dirndl
1 Formal attire
90 Bermudas
91 High-waisted shorts
92 Low-waisted shorts
93 Playsuits Playsuit
94 Overalls Overall
95 Blazers Blazer
96 Cardigans Cardigan
97 Hoodies Hoodie
98 Sweatshirts Sweatshirt
99 T-shirts T-shirt
100 Tank tops Tank top
101 High-waisted pants and crop top
102 Maxi skirt and tank top
103 Blazer and jeans
194 Satin or silk chemise
195 Babydoll
196 Kimono
197 Wedding dress
198 Sari
199 Hanbok
200 Dirndl
+3 -1
View File
@@ -24,4 +24,6 @@ octane engine
ultra high res
masterpiece
lots of details
dslr
dslr
photolab
adobe lightroom
1 8K
24 ultra high res
25 masterpiece
26 lots of details
27 dslr
28 photolab
29 adobe lightroom
+3 -1
View File
@@ -32,4 +32,6 @@ over the shoulder shot
selfie shot angle
High exposure
Aerial View
cinematic shot
cinematic shot
overhead angle
Sharp focus
1 extreme wide shot
32 selfie shot angle
33 High exposure
34 Aerial View
35 cinematic shot
36 overhead angle
37 Sharp focus
+3 -1
View File
@@ -21,4 +21,6 @@ Snowing
Raining
Clear skies
Sunny
Bathed in shadows
Bathed in shadows
Thunderstorm
Foggy
1 at Golden hour
21 Raining
22 Clear skies
23 Sunny
24 Bathed in shadows
25 Thunderstorm
26 Foggy
+11 -2
View File
@@ -1,5 +1,6 @@
Golden ratio
Rule of Thirds
dynamic composition
-color- outlines
Paint splotches
Light streaks
@@ -11,7 +12,7 @@ made of -material-
-color- and -color- dust particles
inticrate details
behance
geometric pattern
geometric patterns
raytraced reflections
delicate
opulent
@@ -25,4 +26,12 @@ Swirling
Ribbons
Spirals
-color- explosions
Folded -material-
Folded -material-
-color- lightning bolts
under water
halation
bloom
caustics
Swirling -material-
vignette
Instagram
1 Golden ratio
2 Rule of Thirds
3 dynamic composition
4 -color- outlines
5 Paint splotches
6 Light streaks
12 -color- and -color- dust particles
13 inticrate details
14 behance
15 geometric pattern geometric patterns
16 raytraced reflections
17 delicate
18 opulent
26 Ribbons
27 Spirals
28 -color- explosions
29 Folded -material-
30 -color- lightning bolts
31 under water
32 halation
33 bloom
34 caustics
35 Swirling -material-
36 vignette
37 Instagram
+1 -1
View File
@@ -19,7 +19,7 @@ steps = 0
while steps < loops:
# build prompt
randomprompt = build_dynamic_prompt(5,"all","all","all")
randomprompt = build_dynamic_prompt(7,"all","all","all")
# prompt + size
+1 -1
View File
@@ -25,7 +25,7 @@ class Script(scripts.Script):
def ui(self, is_img2img):
with gr.Tab("Main"):
with gr.Row():
insanitylevel = gr.Slider(1, 10, value=5, step=1, label="Higher levels increases complexity and randomness of generated prompt")
insanitylevel = gr.Slider(1, 10, value=7, step=1, label="Higher levels increases complexity and randomness of generated prompt")
with gr.Row():
with gr.Column():
subject = gr.Dropdown(