From 70bd21f09a8a9adf69abdd132e14df74058b747b Mon Sep 17 00:00:00 2001 From: binary-husky <505030475@qq.com> Date: Sat, 22 Apr 2023 18:19:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=8C=E7=BA=A7=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E8=BF=90=E8=A1=8C=E7=9A=84=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/WithFastapi.md | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/docs/WithFastapi.md b/docs/WithFastapi.md index 9f4baa1..188b527 100644 --- a/docs/WithFastapi.md +++ b/docs/WithFastapi.md @@ -2,26 +2,41 @@ We currently support fastapi in order to solve sub-path deploy issue. -1. checkout to `subpath` branch - -``` sh -git checkout subpath -``` - - -2. merge lastest features (optional) - -``` sh -git merge master -``` - -3. change CUSTOM_PATH setting in `config.py` +1. change CUSTOM_PATH setting in `config.py` ``` sh nano config.py ``` -4. Go! +2. Edit main.py + +```diff + auto_opentab_delay() + - demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION, favicon_path="docs/logo.png") + + demo.queue(concurrency_count=CONCURRENT_COUNT) + + - # 如果需要在二级路径下运行 + - # CUSTOM_PATH, = get_conf('CUSTOM_PATH') + - # if CUSTOM_PATH != "/": + - # from toolbox import run_gradio_in_subpath + - # run_gradio_in_subpath(demo, auth=AUTHENTICATION, port=PORT, custom_path=CUSTOM_PATH) + - # else: + - # demo.launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION, favicon_path="docs/logo.png") + + + 如果需要在二级路径下运行 + + CUSTOM_PATH, = get_conf('CUSTOM_PATH') + + if CUSTOM_PATH != "/": + + from toolbox import run_gradio_in_subpath + + run_gradio_in_subpath(demo, auth=AUTHENTICATION, port=PORT, custom_path=CUSTOM_PATH) + + else: + + demo.launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION, favicon_path="docs/logo.png") + +if __name__ == "__main__": + main() +``` + + +3. Go! ``` sh python main.py