DiscordDall-E, hereon referred to as DallBoi (as that's what it's called on my guild), is a Discord Bot that talks to a self hosted Dall-E backend. It is therefore quite a simple bot - however it offers quite a fair bit of fun, and bypasses any ratelimiting found on HuggingFace, assuming you have a good enough PC!
The Backend and Bot both happilys runs on a PC with an RTX3070, 32GB RAM and a i5-10600K.
The bot is a bit rough around the edges so apologies in advance...
Dall-E playground offers the backend the bot utilises to serve requests, please follow the instructions on the repository to spin up the required containers. You can get away without using the frontend to save some resources.
Install the requirements as per the text file, preferrably as a venv. Using the Discord Developer portal, create an application, bot user and tokens, and use a .env
file to store these. As slash commands take some time to register globally, you may wish to specify a test_guild_id
in order to begin using them immediately.
DallBoi utilises NextCord, which allows us to use Slash Commands as a form of interactions with the Bot
/generate is the bread and butter of the bot. It sends a prompt, and a default integer (4) number of images to generate. Generate utilises aiohttp
to send async HTTP requests to the backend, which enables multiple users or concurrent requests, compared to using just requests
.
On the above PC Specification, the bot will take roughly 26 seconds to generate, concatenate and send an image to the guild, this however, depends heavily on how many requests are being served.
There will be times where the Backend cannot provision enough VRAM for the request, this will only typically happen if there are too many requests being served. In these cases, the exception is handled and a friendly error message is sent to the guild.