Skip to content

Commit

Permalink
Open a port from docker container to local
Browse files Browse the repository at this point in the history
  • Loading branch information
cobanov committed Jun 29, 2023
1 parent 67d7a7c commit 07f766c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Provided docker image is based on NGC PyTorch repository. To quickly try out vis

```sh
docker build . -t draggan:latest
docker run -v "$PWD":/workspace/src -it draggan:latest bash
cd src && python visualizer_drag_gradio.py
docker run -p 7860: 7860 -v "$PWD":/workspace/src -it draggan:latest bash
cd src && python visualizer_drag_gradio.py --listen
```
Now you can open a shared link from Gradio (printed in the terminal console).
Beware the Docker image takes about 25GB of disk space!
Expand Down
7 changes: 6 additions & 1 deletion visualizer_drag_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
parser = ArgumentParser()
parser.add_argument('--share', action='store_true',default='True')
parser.add_argument('--cache-dir', type=str, default='./checkpoints')
parser.add_argument(
"--listen",
action="store_true",
help="launch gradio with 0.0.0.0 as server name, allowing to respond to network requests",
)
args = parser.parse_args()

cache_dir = args.cache_dir
Expand Down Expand Up @@ -863,4 +868,4 @@ def on_click_show_mask(global_state, show_mask):

gr.close_all()
app.queue(concurrency_count=3, max_size=20)
app.launch(share=args.share)
app.launch(share=args.share, server_name="0.0.0.0" if args.listen else "127.0.0.1")

0 comments on commit 07f766c

Please sign in to comment.