Skip to content

Commit

Permalink
dalle preview
Browse files Browse the repository at this point in the history
  • Loading branch information
AineeJames committed Mar 24, 2023
1 parent e637e5b commit 3fb9c49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion gpterminator/GPTerminator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from pathlib import Path
import pyperclip
import time
import requests
import climage

class GPTerminator:
def __init__(self):
Expand Down Expand Up @@ -238,7 +240,11 @@ def useDalle(self):
) as status:
status.update(status="[bright_black]Generating image...[/]")
img_response = openai.Image.create(prompt=user_in, n=1, size="1024x1024")
image_url = img_response["data"][0]["url"]
image_url = img_response["data"][0]["url"]
resp = requests.get(image_url, stream=True)
cli_image = climage.convert(resp.raw, is_unicode=True)
self.console.print(f"[bold green]Image preview:[/]")
print(cli_image)
self.console.print(f"[bold green]Link: [/][bright_black]{image_url}[/]")
pyperclip.copy(image_url)
self.console.print(f"[bright_black]Image link copied to clipboard![/]")
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = gpterminator
version = 0.1.6
version = 0.1.7
author = Aiden Olsen
description = See https://github.com/AineeJames/ChatGPTerminator for more details!
long_description = file: README.md
Expand All @@ -20,6 +20,7 @@ install_requires =
pyperclip==1.8.2
rich==13.3.2
tiktoken==0.3.1
climage==0.1.3

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit 3fb9c49

Please sign in to comment.