Skip to content
Snippets Groups Projects
Commit edd6b88b authored by fima's avatar fima :beers:
Browse files

Merge branch 'hotfix-gradio_ports' into 'main'

Hotfix to get the proper gradio port

See merge request !34
parents fc2c0cb6 abb4e450
No related branches found
No related tags found
1 merge request!34Hotfix to get the proper gradio port
...@@ -272,15 +272,24 @@ def run_gradio_app(gradio_interface): ...@@ -272,15 +272,24 @@ def run_gradio_app(gradio_interface):
host = "0.0.0.0" host = "0.0.0.0"
# Get port using the QIM API # Get port using the QIM API
port_dict = get_port_dict() port_dict = get_port_dict()
gradio_header(gradio_interface.title, port_dict["port"])
if "gradio_port" in port_dict:
port = port_dict["gradio_port"]
elif "port" in port_dict:
port = port_dict["port"]
else:
raise Exception("Port not specified from QIM API")
print(port_dict)
gradio_header(gradio_interface.title, port)
# Create FastAPI with mounted gradio interface # Create FastAPI with mounted gradio interface
app = FastAPI() app = FastAPI()
path = f"/gui/{port_dict['username']}/{port_dict['port']}/" path = f"/gui/{port_dict['username']}/{port}/"
app = gr.mount_gradio_app(app, gradio_interface, path=path) app = gr.mount_gradio_app(app, gradio_interface, path=path)
# Full path # Full path
print(f"http://{host}:{port_dict['port']}{path}") print(f"http://{host}:{port}{path}")
# Run the FastAPI server usign uvicorn # Run the FastAPI server usign uvicorn
run(app, host="0.0.0.0", port=int(port_dict["port"])) run(app, host="0.0.0.0", port=int(port))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment