Skip to content

Commit

Permalink
dynammic port for gradio
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Aug 28, 2023
1 parent 927f8bd commit 548aa79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions jhub_apps/examples/gradio_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ def greet(name):


parser = argparse.ArgumentParser(description="Process CLI args for gradio")
parser.add_argument("--server-port", type=str, help="server_port for gradio app", default=8500)
parser.add_argument(
"--server-port", type=str, help="server_port for gradio app", default=8500
)
parser.add_argument("--root-path", type=str, help="root_path for gradio", default=None)
cli_args = parser.parse_args()

demo.launch(
server_port=8500,
root_path=cli_args.root_path
)
demo.launch(server_port=int(cli_args.server_port), root_path=cli_args.root_path)
2 changes: 1 addition & 1 deletion jhub_apps/spawner/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
COMMANDS = {
"gradio": {
"args": [
"--destport=8500",
"--destport=0",
"python",
f'{EXAMPLES_PATH.get("gradio")}',
],
Expand Down
1 change: 1 addition & 0 deletions jhub_apps/spawner/spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def get_args(self):
argv.append(base_url_param)
if framework == "gradio":
args = [
"{--}server-port={port}",
"{--}root-path=" + jh_service_prefix,
"--ready-check-path=/",
]
Expand Down

0 comments on commit 548aa79

Please sign in to comment.