Add "styles" to the photo prompt

In order to get more variations from the stock photo/Instragram vibe we
usually get.
This commit is contained in:
Mikkel Munch Mortensen 2023-12-06 09:41:41 +01:00
parent f21a941865
commit 882c8afd8e

View file

@ -70,14 +70,25 @@ def get_photo_url(menu: str):
"TE": "trailers", "TE": "trailers",
} }
styles = [
"in a school canteen",
"from grandma's kitchen",
"cooked over a camp fire",
"as fast food take away",
"on a prison canteen tray",
"served in the style of a Michelin restaurant",
]
style = random.choice(styles)
prompt = f"A meal of {translation} {style}"
request_data = { request_data = {
"model": "photo", "model": "photo",
"negative_prompt": "", "negative_prompt": "",
"prompt": translation, "prompt": prompt,
"token": token, "token": token,
"version": "35s5hfwn9n78gb06", "version": "35s5hfwn9n78gb06",
} }
sys.stdout.write("Asking Craiyon to generate images for the menu...\n") sys.stdout.write("Asking Craiyon to generate images for the menu with the prompt:\n")
sys.stdout.write(f"{prompt}\n")
craiyon_start = datetime.datetime.now() craiyon_start = datetime.datetime.now()
try: try:
response = requests.post( response = requests.post(
@ -163,6 +174,7 @@ else:
"flag-us": ["amerikansk"], "flag-us": ["amerikansk"],
"flag-th": ["thai"], "flag-th": ["thai"],
"hushed": ["surprise", "surprice"], "hushed": ["surprise", "surprice"],
"tema": [" tema", "tema "],
"jack_o_lantern": ["halloween"], "jack_o_lantern": ["halloween"],
"spider_web": ["halloween"], "spider_web": ["halloween"],
"bat": ["halloween"], "bat": ["halloween"],
@ -199,7 +211,7 @@ else:
"lemon": ["citron"], "lemon": ["citron"],
"mushroom": ["svampe", "kantarel", "champignon"], "mushroom": ["svampe", "kantarel", "champignon"],
"eggplant": ["moussaka", "mousakka"], "eggplant": ["moussaka", "mousakka"],
"cheese_wedge": [" ost"], "cheese_wedge": [" ost", "parmesan", "mozzarella"],
"beans": ["bønne"], "beans": ["bønne"],
"olive": ["oliven"], "olive": ["oliven"],
"bell_pepper": ["peberfrugt"], "bell_pepper": ["peberfrugt"],
@ -223,6 +235,7 @@ else:
"potato": ["kartoffel", "kartofler"], "potato": ["kartoffel", "kartofler"],
"tomato": ["tomat"], "tomato": ["tomat"],
"apple": ["æble"], "apple": ["æble"],
"pineapple": ["ananas"],
"beer": ["øl ", " øl"], "beer": ["øl ", " øl"],
"peanuts": ["peanut"], "peanuts": ["peanut"],
"baguette_bread": ["flute"], "baguette_bread": ["flute"],
@ -247,7 +260,7 @@ else:
tokens = { tokens = {
"persons": random.choice([ "persons": random.choice([
"Abrahims", "Abrahims",
"Elias'", "Lewis'",
"Martins", "Martins",
"Benjamins", "Benjamins",
"Karstens", "Karstens",