mirror of
https://git.mirrors.martin98.com/https://github.com/danielgatis/rembg
synced 2025-08-17 22:05:58 +08:00
rembg s (http server), add --host parameter (#571)
This commit is contained in:
parent
be319d3489
commit
70b4c44eee
@ -190,6 +190,10 @@ rembg p -w path/to/input path/to/output
|
|||||||
|
|
||||||
Used to start http server.
|
Used to start http server.
|
||||||
|
|
||||||
|
```
|
||||||
|
rembg s --host 0.0.0.0 --port 5000 --log_level info
|
||||||
|
```
|
||||||
|
|
||||||
To see the complete endpoints documentation, go to: `http://localhost:5000/api`.
|
To see the complete endpoints documentation, go to: `http://localhost:5000/api`.
|
||||||
|
|
||||||
Remove the background from an image url
|
Remove the background from an image url
|
||||||
|
@ -31,6 +31,14 @@ from ..sessions.base import BaseSession
|
|||||||
show_default=True,
|
show_default=True,
|
||||||
help="port",
|
help="port",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"-h",
|
||||||
|
"--host",
|
||||||
|
default="0.0.0.0",
|
||||||
|
type=str,
|
||||||
|
show_default=True,
|
||||||
|
help="host",
|
||||||
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-l",
|
"-l",
|
||||||
"--log_level",
|
"--log_level",
|
||||||
@ -47,7 +55,7 @@ from ..sessions.base import BaseSession
|
|||||||
show_default=True,
|
show_default=True,
|
||||||
help="number of worker threads",
|
help="number of worker threads",
|
||||||
)
|
)
|
||||||
def s_command(port: int, log_level: str, threads: int) -> None:
|
def s_command(port: int, host: str, log_level: str, threads: int) -> None:
|
||||||
"""
|
"""
|
||||||
Command-line interface for running the FastAPI web server.
|
Command-line interface for running the FastAPI web server.
|
||||||
|
|
||||||
@ -282,7 +290,7 @@ def s_command(port: int, log_level: str, threads: int) -> None:
|
|||||||
app = gr.mount_gradio_app(app, interface, path="/")
|
app = gr.mount_gradio_app(app, interface, path="/")
|
||||||
return app
|
return app
|
||||||
|
|
||||||
print(f"To access the API documentation, go to http://localhost:{port}/api")
|
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:{port}")
|
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="0.0.0.0", port=port, log_level=log_level)
|
uvicorn.run(gr_app(app), host=host, port=port, log_level=log_level)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user