Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyaboulton committed Jul 18, 2023
1 parent be8946c commit 191aee0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/python/gradio_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,17 @@ def deploy_discord(
private: bool = True,
persist_state: bool = False,
):
"""
Deploy the upstream app as a discord bot. Currently only supports gr.ChatInterface.
Parameters:
discord_bot_token: This is the "password" needed to be able to launch the bot. Users can get a token by creating a bot app on the discord website. If run the method without specifying a token, the space will explain how to get one. See here: https://huggingface.co/spaces/freddyaboulton/test-discord-bot-v1.
api_names: The api_names of the app to turn into bot commands. This parameter currently has no effect as ChatInterface only has one api_name ('/chat').
command_names: The names of the command the bot will have. Must be the same length as api_names. For gr.ChatInterface, this list must contain one element. For example, if the value is ['bot'], the bot command can be triggered via !bot.
to_id: The name of the space hosting the discord bot. If None, the name will be gradio-discord-bot-{random-substring}
hf_token: HF api token with write priviledges in order to upload the files to HF space. Can be ommitted if logged in via the HuggingFace CLI, unless the upstream space is private. Obtain from: https://huggingface.co/settings/token
private: Whether the space hosting the discord bot is private. The visibility of the discord bot itself is set via the discord website. See https://huggingface.co/spaces/freddyaboulton/test-discord-bot-v1
persist_state: Currently has no effect.
"""
if self.config["mode"] != "chat_interface":
raise ValueError(
"Only demos built with gr.ChatInterface can be deployed as discord bots automatically for now."
Expand Down

0 comments on commit 191aee0

Please sign in to comment.