fix sub-path deploy

This commit is contained in:
yuxiaoyuan0406 2023-04-20 17:21:47 +08:00
parent faffc59f51
commit 4cfbacdb26

19
main.py
View File

@ -171,4 +171,21 @@ def auto_opentab_delay():
threading.Thread(target=auto_update, name="self-upgrade", daemon=True).start()
auto_opentab_delay()
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION)
# demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION)
demo.queue(concurrency_count=CONCURRENT_COUNT)
CUSTOM_PATH = '/chatgpt'
import uvicorn
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_main():
return {"message": "NULL"}
app = gr.mount_gradio_app(app, demo, path=CUSTOM_PATH)
if __name__ == '__main__':
uvicorn.run(app, host="0.0.0.0", port=PORT)