Spaces:
Running
on
CPU Upgrade
A newer version of the Gradio SDK is available:
5.5.0
The Gradio Discord BotBETA
The Gradio Discord Bot is a way to use any Hugging Face Space as a Bot from within your Discord server -- all without writing any code.
Below, we show examples how to use the Bot in your server to:
- 🌎 Translate between languages
- 🗣️ Convert text to speech
- 🔢 Do math calculations
- 🖼️ Generate images
All for free and without having to code anything! Installation instructions are below, or you can try it out right now in the #gradio-bot-playground channel in the Hugging Face Discord.
Installing in your own Discord Server
Installing the Gradio Discord Bot is very simple:
Copy and paste the following link in your browser: https://discord.com/api/oauth2/authorize?client_id=1040198143695933501&permissions=294406716480&scope=bot
Choose which Discord server you'd like to add it to (you must have permissions to add Bots to that server of course)
- Accept the permissions for the Gradio Bot
- You can confirm that the Gradio Discord Bot has been successfully installed in your server by going to the server and seeing if there is an account with the name
@GradioBot
in your server:
- (Optional) If you would like to use
@GradioBot
in a private channel, then you must add@GradioBot
to that channel. In Discord, you can do this by right-clicking on the channel name, and then selecting ‘Edit Channel’. Then, go to ‘Permissions’ and select ‘Add a Role’ and find@GradioBot
Usage
Now that the Gradio Discord bot is installed, here's how to use it in any any channel in your Discord server:
- From the channel, tag
@GradioBot
followed by the name of a Space you'd like to try, such asabidlabs/en2fr
(a Space that translates from English to French) orabidlabs/speak
(a Space that converts text to spoken speech), or any of the more than 5,000 Gradio demos on Hugging Face Spaces.
- Once you press enter, you'll notice that the name of
@GradioBot
will change to reflect the name of the Space that it has loaded:
- Now type in the input you'd like to pass into the Space. In this example, we'll pass in an English phrase: "Hello, friends." The input must be enclosed in double-quotes. Otherwise, it will be interpreted as the name of a new Space that you are trying to load. Once you
- If you'd like to load a new Space, just type in the name of a new Space (without any quotation marks) and
@GradioBot
will load the new Space instead. If you'd like to reset to the initial state of the@GradioBot
, you can type in@GradioBot exit
.
We'll show how to use @GradioBot
with a few more complex Spaces below:
More examples
🗣️ Convert text to speech (abidlabs/speak
)
The @GradioBot
can handle media as well as text. For example, this Space converts text to speech recordings. Here's how to use it:
In a channel, type
@GradioBot abidlabs/speak
Then, type in some text in quotation marks that you'd like to convert to speech, such as
@GradioBot "Look at this cool demo!"
. You should see an audio file returned by@GradioBot
:
Note: generation can take a minute or even longer, depending on the length of the input and how many other people are using this Space
🔢 Do math calculations (abidlabs/calc
)
The @GradioBot
can handle Spaces that take multiple inputs. Each input must be in quotes and separated by a space. For example, this Space takes in two numbers and a mathematical operation. Here's how to use it:
In a channel, type
@GradioBot abidlabs/calc
Then, type in
@GradioBot
, followed by the inputs, separated by Spaces. For example:@GradioBot "4" "divide" "3"
Here's how it looks:
🖼️ Generate images (abidlabs/images
)
Here's another example that shows that @GradioBot
can handle media. Using this Space converts text to images. Here's how to use it:
In a channel, type
@GradioBot abidlabs/images
Then, type in some text in quotation marks that you'd like to convert into an image, such as
@GradioBot "a cartoon astronaut riding a horse"
. You should see an image file returned by@GradioBot
:
Note: generation can take a minute or even longer, depending on how many other people are using this Space
About
The first version of the Gradio Discord Bot was built by the Gradio team at a hackathon in Paris in Nov. 2022. We hope you enjoy it and find it useful!
Contributing
The Gradio Discord Bot is completely open-source. Feel free to open issues or pull requests in this repo to make it better!