From bc4f02904587d348790a2fcf9efb8ddf7ca490ca Mon Sep 17 00:00:00 2001 From: Paillat Date: Thu, 16 Feb 2023 10:40:37 +0100 Subject: [PATCH] Update makeprompt.py --- code/makeprompt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/makeprompt.py b/code/makeprompt.py index 595bae8..e91a26d 100644 --- a/code/makeprompt.py +++ b/code/makeprompt.py @@ -157,6 +157,7 @@ To include IMAGES, botator does [image:"here a short title of the image"], then files = [] filenames = [] if images != []: response = f"{response}\n\n*Images from unsplash.com*" + url = None for desc in images: #weuse unsplash to get an image with their api (https://source.unsplash.com/1600x900/?{desc}) #we use the description of the image as a search query @@ -165,6 +166,7 @@ To include IMAGES, botator does [image:"here a short title of the image"], then response = response.replace(f"[image:{desc}]", "", 1) #we first get the image url desc = desc.replace(" ", "+") + desc = desc.replace('"', '') url = f"https://source.unsplash.com/1600x900/?{desc}" #we then download the image image = requests.get(url)