changed logging for stable diffusion

This commit is contained in:
phixxy 2024-01-17 23:54:47 -08:00
parent c24838074f
commit 60c7a4f335

View file

@ -5,6 +5,7 @@ import aiohttp
import os import os
import time import time
import random import random
import json
from PIL import Image, PngImagePlugin from PIL import Image, PngImagePlugin
from discord.ext import commands from discord.ext import commands
@ -294,14 +295,15 @@ async def imagine(ctx):
with open(my_filename, "rb") as fh: with open(my_filename, "rb") as fh:
f = discord.File(fh, filename=my_filename) f = discord.File(fh, filename=my_filename)
log_data = {'Author': ctx.author.name, 'Prompt': prompt, "Filename":my_filename}
log_data = f'Author: {ctx.author.name}, Prompt: {prompt}, Filename:{my_filename}\n'
with open("databases/stable_diffusion.log", 'a') as log_file: with open("databases/stable_diffusion.log", 'a') as log_file:
log_file.writelines(list(log_data)) log_file.writelines(log_data)
await ctx.send(f'Generated by: {ctx.author.name}\nPrompt: {prompt}', file=f) await ctx.send(f'Generated by: {ctx.author.name}\nPrompt: {prompt}', file=f)
await http_session.close() await http_session.close()
@commands.command( @commands.command(
description="Describe", description="Describe",
help="Get better understanding of what the bot \"sees\" when you post an image! (Runs it through CLIP) Usage !describe (image link)", help="Get better understanding of what the bot \"sees\" when you post an image! (Runs it through CLIP) Usage !describe (image link)",