BoomBot is a Discord bot that generates music samples in seconds using MusicGen. See the demo with audio here. You can try BoomBot out for yourself by joining the Discord server and typing /generate
in the #general
channel.
This entire app, from the backend API to the web app, is deployed serverlessly on Modal.
- React Frontend (
src/frontend/
) - FastAPI server (
src/bot.py
) - Language model (
src/main.py
)
Read our accompanying docs for further detail on how it all works.
- Create a Modal account.
- Install
modal
in your current Python virtual environment (pip install modal
) - Set up a Modal token in your environment (
modal token new
)
Follow the steps in our docs to create a new Discord app and set up a Modal secret called boombot-discord-secret
with the key DISCORD_PUBLIC_KEY
.
You can serve the app ephemerally on Modal by running this command from the repo's root directory:
modal serve src.bot
You'll then see a URL printed in the terminal output (like https://rachelspark--boombot-app-dev.modal.run
) that you can then use to navigate to the web app in your browser, and use as a root path for the webhook your Discord app will request when a user interacts with it. You should point your Discord app to your POST
endpoint on this URL in the Discord Developer Portal (as explained in the docs) and develop the bot while the modal serve
process is running, as changes to any of the project files will be automatically applied.
Once you're satisfied with your changes, your can deploy your app using
modal deploy src.bot
Make sure to update the URL your Discord app points to.