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",
}
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 = {
"model": "photo",
"negative_prompt": "",
"prompt": translation,
"prompt": prompt,
"token": token,
"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()
try:
response = requests.post(
@ -157,12 +168,13 @@ else:
for emoji, keywords in {
"birthday": ["tillykke", "fødselsdag"],
"flag-in": ["indisk", "indien"],
"flag-gr": ["græsk", "grækenland"],
"flag-gr": ["græsk ", "grækenland"],
"flag-es": ["spansk", "spanien"],
"flag-kr": ["korea"],
"flag-us": ["amerikansk"],
"flag-th": ["thai"],
"hushed": ["surprise", "surprice"],
"tema": [" tema", "tema "],
"jack_o_lantern": ["halloween"],
"spider_web": ["halloween"],
"bat": ["halloween"],
@ -199,7 +211,7 @@ else:
"lemon": ["citron"],
"mushroom": ["svampe", "kantarel", "champignon"],
"eggplant": ["moussaka", "mousakka"],
"cheese_wedge": [" ost"],
"cheese_wedge": [" ost", "parmesan", "mozzarella"],
"beans": ["bønne"],
"olive": ["oliven"],
"bell_pepper": ["peberfrugt"],
@ -223,6 +235,7 @@ else:
"potato": ["kartoffel", "kartofler"],
"tomato": ["tomat"],
"apple": ["æble"],
"pineapple": ["ananas"],
"beer": ["øl ", " øl"],
"peanuts": ["peanut"],
"baguette_bread": ["flute"],
@ -247,7 +260,7 @@ else:
tokens = {
"persons": random.choice([
"Abrahims",
"Elias'",
"Lewis'",
"Martins",
"Benjamins",
"Karstens",