From 882c8afd8e939878736a688c4db2fa07a3134a83 Mon Sep 17 00:00:00 2001 From: Mikkel Munch Mortensen <3xm@detfalskested.dk> Date: Wed, 6 Dec 2023 09:41:41 +0100 Subject: [PATCH] Add "styles" to the photo prompt In order to get more variations from the stock photo/Instragram vibe we usually get. --- frokostbot.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/frokostbot.py b/frokostbot.py index b66dc39..81c26d5 100644 --- a/frokostbot.py +++ b/frokostbot.py @@ -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",