Skip to content

Commit

Permalink
Added colorful log output to generate_image_from_description
Browse files Browse the repository at this point in the history
  • Loading branch information
btfranklin committed Aug 25, 2024
1 parent 655b160 commit 05a68c2
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from colorama import Back, Fore
import requests
from spooklight.settings import Settings


def generate_image_from_description(llm_client, image_description):

print(Back.MAGENTA + "GENERATING NEXT IMAGE FROM DESCRIPTION")

response = llm_client.images.generate(
model=Settings.get_generate_image_model(),
prompt=image_description,
Expand All @@ -20,8 +23,11 @@ def generate_image_from_description(llm_client, image_description):
# Check if the request was successful
if response.status_code == 200:
image = response.content
print(f"Image downloaded into memory from {image_url}")
print(Fore.YELLOW + f"Image downloaded into memory from {image_url}")
else:
print(f"Failed to download the file. Status code: {response.status_code}")
print(
Fore.RED
+ f"Failed to download the file. Status code: {response.status_code}"
)

return image

0 comments on commit 05a68c2

Please sign in to comment.