Rembg is a tool to remove images background
Add --no-ui flag to server command to reduce idle CPU usage (#824)
Daniel Gatis02ca21f4cae4
diff --git a/README.md b/README.mdindex 872f63c..a8fb640 100644--- a/README.md+++ b/README.md@@ -184,6 +184,12 @@ rembg s --host 0.0.0.0 --port 7000 --log_level infoFor complete API documentation, visit: `http://localhost:7000/api`+**Disable the Gradio UI (reduces idle CPU usage):**++```shell+rembg s --no-ui+```+**Remove background from an image URL:**```shelldiff --git a/rembg/commands/s_command.py b/rembg/commands/s_command.pyindex 3e49fe9..6f836a4 100644--- a/rembg/commands/s_command.py+++ b/rembg/commands/s_command.py@@ -55,7 +55,14 @@ from ..sessions.base import BaseSessionshow_default=True,help="number of worker threads",)-def s_command(port: int, host: str, log_level: str, threads: int) -> None:+ "--no-ui",+ is_flag=True,+ default=False,+ show_default=True,+ help="disable the Gradio UI (reduces idle CPU usage)",+)+def s_command(port: int, host: str, log_level: str, threads: int, no_ui: bool) -> None:"""Command-line interface for running the FastAPI web server.@@ -323,8 +330,11 @@ def s_command(port: int, host: str, log_level: str, threads: int) -> None:print(f"To access the API documentation, go to http://{'localhost' if host == '0.0.0.0' else host}:{port}/api")- print(- f"To access the UI, go to http://{'localhost' if host == '0.0.0.0' else host}:{port}"- )+ if not no_ui:+ print(+ f"To access the UI, go to http://{'localhost' if host == '0.0.0.0' else host}:{port}"+ )- uvicorn.run(gr_app(app), host=host, port=port, log_level=log_level)+ uvicorn.run(+ app if no_ui else gr_app(app), host=host, port=port, log_level=log_level+ )