Bot | Code Link | Invite Link |
---|---|---|
CodeLlama 13B | Code | Invite Bot |
DeepFloydIF | Code | Invite Bot |
Falcon 180B | Code | Invite Bot |
Wuerstchen | Code | Invite Bot |
AudioLDM 2 | Code | - |
MusicGen | Code | - |
After that, we'll have a working discord bot. So how do we spice it up with machine learning?
Almost any Gradio app can be used as an API! This means we can query most Spaces on the Hugging Face Hub and use them in our discord bots.
Here's an extremely simplified example 💻:
from gradio_client import Client
musicgen = Client("huggingface-projects/transformers-musicgen", hf_token=os.getenv("HF_TOKEN"))
# call this function when we use a command + prompt
async def music_create(ctx, prompt):
# run_in_executor for the blocking function
loop = asyncio.get_running_loop()
job = await loop.run_in_executor(None, music_create_job, prompt)
# extract what we want from the outputs
video = job.outputs()[0][0]
# send what we want to discord
await thread.send(video_file)
# submit as a Gradio job; this makes retrieving outputs simpler
def music_create_job(prompt):
# pass prompt and other parameters if necessary
job = musicgen.submit(prompt, api_name="/predict")
return job
In summary, we:
🎉 And voila! 🎉
For further explorations (depending on your needs), we can recommend checking these out 🧐: