Swagger UI does not show up in JupyterLab

Viewed 83

I have saved one R script with name MC_APIv1.1-Prod.R in Jupyterlab and when I run the following code in R Console of Jupyterlab :

plumber::plumb("MC_APIv1.1-Prod.R")$run(host = "0.0.0.0", port = 5763,swagger = TRUE)

It gives the following message:

Running plumber API at http://0.0.0.0:5763

Running swagger Docs at http://127.0.0.1:5763/__docs__/

But I can't see the swagger UI while kernel is still running. When I run this code in RStudio then I can see the swagger window and it shows the plot in the browser window but it is not working in my case.

Can anyone please explain what is happening here and how to resolve this issue. Any help would be appreciated.

Complete code for the mentioned R file is here.

2 Answers

The docs endpoint is only open for access from the local machine as the url is 127.0.0.1.

The swagger argument is deprecated according to docs https://www.rplumber.io/reference/Plumber.html?q=swagger#method-run-

try with

plumber::plumb("MC_APIv1.1-Prod.R")$run(host = "0.0.0.0", port = 5763, docs="swagger")

or

plumber::plumb("MC_APIv1.1-Prod.R")$set_docs("swagger")$run(host = "0.0.0.0", port = 5763)

Related