Skip to content

Commit

Permalink
fixed reset issue; attempted to make draw async
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Dinan committed Mar 9, 2023
1 parent a6b6470 commit 80060cb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
discord.py==2.1.0
python-dotenv==0.21.1
openai==0.27.0
revChatGPT==3.1.5
revChatGPT==3.2.0
6 changes: 3 additions & 3 deletions src/art.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ async def draw(prompt) -> str:
with open(file_name, mode="w", encoding="utf-8") as file:
json.dump(response, file)

path = str(convert(file_name))
path = await str(convert(file_name))

return path


# code stolen from https://realpython.com/generate-images-with-dalle-openai-api/
def convert(path):
async def convert(path):
DATA_DIR = Path.cwd() / "responses"
JSON_FILE = DATA_DIR / path
IMAGE_DIR = Path.cwd() / "images"
Expand All @@ -42,7 +42,7 @@ def convert(path):
with open(JSON_FILE, mode="r", encoding="utf-8") as file:
response = json.load(file)

for index, image_dict in enumerate(response["data"]):
async for index, image_dict in enumerate(response["data"]):
image_data = b64decode(image_dict["b64_json"])
image_file = IMAGE_DIR / f"{JSON_FILE.stem}-{index}.png"

Expand Down
2 changes: 1 addition & 1 deletion src/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def switch_persona(persona) -> None:
pass

elif CHAT_MODEL == "OFFICIAL":
official_chatbot.reset_chat()
official_chatbot.reset()
async for response in official_chatbot.ask(personas.PERSONAS.get(persona)):
pass

1 change: 1 addition & 0 deletions starting_prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello world

0 comments on commit 80060cb

Please sign in to comment.