Linux command
gradio 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Run a Gradio app
gradio [app.py]
Run directly with Python
python [app.py]
Deploy the current directory
gradio deploy
Deploy with a custom title
gradio deploy --title [my-app] --app-file [app.py]
Print the Gradio environment info
gradio environment
Run with debug output
GRADIO_DEBUG=1 python [app.py]
说明
Gradio is a Python library for building machine-learning demos and web UIs, plus a small companion CLI. The gradio command wraps python to run a script with live reload - whenever the watched files change, the server restarts and the browser refreshes automatically, which is the main reason to use gradio app.py instead of python app.py during development. The CLI also exposes gradio deploy, which packages the working directory and pushes it to Hugging Face Spaces for hosting, and gradio environment, which prints diagnostic information. Server settings such as port, host, share links, and authentication are normally configured via arguments to demo.launch() inside the Python script, or via GRADIO_* environment variables.
参数
- deploy
- Subcommand: upload the current directory to Hugging Face Spaces, respecting .gitignore.
- environment
- Subcommand: print Gradio, Python, and OS version info useful for issue reports.
- --title _title_
- (deploy) Name the Hugging Face Space.
- --app-file _file_
- (deploy) Path to the entry Python file (default: app.py).
- --demo-name _name_
- Name of the demo variable inside the script (default: demo).
- --watch-dirs _dirs_
- Additional directories to watch for hot-reload.
FAQ
What is the gradio command used for?
Gradio is a Python library for building machine-learning demos and web UIs, plus a small companion CLI. The gradio command wraps python to run a script with live reload - whenever the watched files change, the server restarts and the browser refreshes automatically, which is the main reason to use gradio app.py instead of python app.py during development. The CLI also exposes gradio deploy, which packages the working directory and pushes it to Hugging Face Spaces for hosting, and gradio environment, which prints diagnostic information. Server settings such as port, host, share links, and authentication are normally configured via arguments to demo.launch() inside the Python script, or via GRADIO_* environment variables.
How do I run a basic gradio example?
Run `gradio [app.py]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does deploy do in gradio?
Subcommand: upload the current directory to Hugging Face Spaces, respecting .gitignore.