Spaces:
Running
Running
修改二级路径运行的说明
Browse files- docs/WithFastapi.md +28 -13
docs/WithFastapi.md
CHANGED
@@ -2,26 +2,41 @@
|
|
2 |
|
3 |
We currently support fastapi in order to solve sub-path deploy issue.
|
4 |
|
5 |
-
1.
|
6 |
|
7 |
``` sh
|
8 |
-
|
9 |
```
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
```
|
17 |
|
18 |
-
3. change CUSTOM_PATH setting in `config.py`
|
19 |
-
|
20 |
-
``` sh
|
21 |
-
nano config.py
|
22 |
-
```
|
23 |
|
24 |
-
|
25 |
|
26 |
``` sh
|
27 |
python main.py
|
|
|
2 |
|
3 |
We currently support fastapi in order to solve sub-path deploy issue.
|
4 |
|
5 |
+
1. change CUSTOM_PATH setting in `config.py`
|
6 |
|
7 |
``` sh
|
8 |
+
nano config.py
|
9 |
```
|
10 |
|
11 |
+
2. Edit main.py
|
12 |
+
|
13 |
+
```diff
|
14 |
+
auto_opentab_delay()
|
15 |
+
- demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION, favicon_path="docs/logo.png")
|
16 |
+
+ demo.queue(concurrency_count=CONCURRENT_COUNT)
|
17 |
+
|
18 |
+
- # 如果需要在二级路径下运行
|
19 |
+
- # CUSTOM_PATH, = get_conf('CUSTOM_PATH')
|
20 |
+
- # if CUSTOM_PATH != "/":
|
21 |
+
- # from toolbox import run_gradio_in_subpath
|
22 |
+
- # run_gradio_in_subpath(demo, auth=AUTHENTICATION, port=PORT, custom_path=CUSTOM_PATH)
|
23 |
+
- # else:
|
24 |
+
- # demo.launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION, favicon_path="docs/logo.png")
|
25 |
+
|
26 |
+
+ 如果需要在二级路径下运行
|
27 |
+
+ CUSTOM_PATH, = get_conf('CUSTOM_PATH')
|
28 |
+
+ if CUSTOM_PATH != "/":
|
29 |
+
+ from toolbox import run_gradio_in_subpath
|
30 |
+
+ run_gradio_in_subpath(demo, auth=AUTHENTICATION, port=PORT, custom_path=CUSTOM_PATH)
|
31 |
+
+ else:
|
32 |
+
+ demo.launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION, favicon_path="docs/logo.png")
|
33 |
+
|
34 |
+
if __name__ == "__main__":
|
35 |
+
main()
|
36 |
```
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
3. Go!
|
40 |
|
41 |
``` sh
|
42 |
python main.py
|