Araeynn commited on
Commit
1671ae5
·
verified ·
1 Parent(s): e061df9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -161,8 +161,10 @@ async def on_message(message:discord.Message):
161
  ats = []
162
  if len(message.attachments) > 0:
163
  for i in message.attachments:
164
- ats.append(f"ImageInput:{i}")
165
- s = f"GPT4 Correct {message.author}: {message.content} Images: {" ".join(ats)}<|end_of_turn|>"
 
 
166
  try:
167
  with open(os.path.join(guild_name, f"{msgchannel_name}.txt"), "a") as f:
168
  f.write(s)
 
161
  ats = []
162
  if len(message.attachments) > 0:
163
  for i in message.attachments:
164
+ if i.content_type == "image":
165
+ Image.open(io.BytesIO(i.read())).save("image.png")
166
+ ats.append(f"ImageInput:{caption("image.png")}")
167
+ s = f"GPT4 Correct {message.author}: {message.content} Attachments: {" ".join(ats)}<|end_of_turn|>"
168
  try:
169
  with open(os.path.join(guild_name, f"{msgchannel_name}.txt"), "a") as f:
170
  f.write(s)