mirror of https://github.com/signalnine/lofi-imgen
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
1.7 KiB
Python
24 lines
1.7 KiB
Python
import tracery
|
|
from tracery.modifiers import base_english
|
|
|
|
rules = {
|
|
'prompt': '#setting#, #modifiers#, #modifiers#, #modifiers#',
|
|
'setting': ['#cosy#', '#place#', '#countryside#', '#train#', '#cityscene#'],
|
|
'cosy': ['cosy scene #time#', 'a hot cup of tea, #weather# outside', 'looking out the window at #city# #time#'],
|
|
'countryside': ['#country# #time#', '#weather# #country# #time#', '#country#'],
|
|
'train': ['#transit# #time#', '#weather# #transit# #time#'],
|
|
'transit': ['train station', 'an old bus stop', 'rail station', 'subway station'],
|
|
'time': ['at night', 'at sunrise', 'at dusk', 'at midnight', 'midday'],
|
|
'weather': ['rainy', 'cloudy', 'foggy', 'clear', 'overcast'],
|
|
'city': ['Tokyo', 'Sydney', 'Paris', 'Kyoto', 'Chicago', 'New York', 'San Francisco', 'Reykjavik', 'Hanoi', 'Hong Kong', 'London', 'Madrid', 'Barcelona', 'Prague', 'Santa Fe', 'Portland', 'New Orleans'],
|
|
'cityscene': ['#place# in #city# #time#', '#weather# #place# in #city#', '#place# #time#'],
|
|
'place': ['art museum', 'old diner', 'fancy restaurant', 'abandoned storefront', 'alleyway', 'dive bar', 'post office', 'cosy cabin', 'hotel', 'covered bridge', 'waterfront', 'pier', 'street scene'],
|
|
'country': ['lakeside dock', 'deep in the woods', 'hillside', 'deer trail', 'hiking trail', 'mountain overlook', 'mountain pass', 'riverbank', 'forest glen', 'meadow'],
|
|
'modifiers': ['detailed', 'trending on artstation', '4k', 'highly realistic', 'fantasy vivid colors', 'ghibli inspired', 'studio ghibli', 'anime', 'anime art style', 'anime concept art', 'vivid colors', 'bokeh', 'aesthetic', 'trending on cgsociety', 'cinematic',]
|
|
}
|
|
|
|
grammar = tracery.Grammar(rules)
|
|
grammar.add_modifiers(base_english)
|
|
|
|
print(grammar.flatten("#prompt#"))
|