Skip to content

Commit

Permalink
add root_path argument to gradio web server. (#2807)
Browse files Browse the repository at this point in the history
Co-authored-by: bertls <s.bertl@iaea.org>
  • Loading branch information
stephanbertl and stephanbertl authored Dec 24, 2023
1 parent c214688 commit 43532db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fastchat/serve/gradio_web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,11 @@ def build_demo(models):
type=str,
help='Set the gradio authentication file path. The file should contain one or more user:password pairs in this format: "u1:p1,u2:p2,u3:p3"',
)
parser.add_argument(
"--gradio-root-path",
type=str,
help="Sets the gradio root path, eg /abc/def. Useful when running behind a reverse-proxy or at a custom URL path prefix"
)
args = parser.parse_args()
logger.info(f"args: {args}")

Expand Down Expand Up @@ -863,4 +868,5 @@ def build_demo(models):
share=args.share,
max_threads=200,
auth=auth,
root_path=args.gradio_root_path
)
6 changes: 6 additions & 0 deletions fastchat/serve/gradio_web_server_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ def build_demo(models, elo_results_file, leaderboard_table_file):
parser.add_argument(
"--leaderboard-table-file", type=str, help="Load leaderboard results and plots"
)
parser.add_argument(
"--gradio-root-path",
type=str,
help="Sets the gradio root path, eg /abc/def. Useful when running behind a reverse-proxy or at a custom URL path prefix"
)
args = parser.parse_args()
logger.info(f"args: {args}")

Expand Down Expand Up @@ -267,4 +272,5 @@ def build_demo(models, elo_results_file, leaderboard_table_file):
share=args.share,
max_threads=200,
auth=auth,
root_path=args.gradio_root_path
)

0 comments on commit 43532db

Please sign in to comment.