unifying code

This commit is contained in:
Your Name
2023-04-22 17:24:22 +08:00
parent 6f7e8076c7
commit 7beea951c6
3 changed files with 12 additions and 11 deletions

View File

@ -521,13 +521,14 @@ class DummyWith():
def __exit__(self, exc_type, exc_value, traceback):
return
def run_gradio(demo, auth, favicon_path, port, custom_path):
def run_gradio(demo, auth, port, custom_path):
import uvicorn
import gradio as gr
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_main():
return {"message": "NULL"}
app = gr.mount_gradio_app(app, demo, path=custom_path, auth=auth, favicon_path=favicon_path)
uvicorn.run(app, host="0.0.0.0", port=port)
if custom_path != "/":
@app.get("/")
def read_main():
return {"message": f"Gradio is running at: {custom_path}"}
app = gr.mount_gradio_app(app, demo, path=custom_path)
uvicorn.run(app, host="0.0.0.0", port=port) # , auth=auth