I am using the Panel tutorial on serving directly from Fastapi with the following code. When i access the /panel
route in my browser, I get a blank white screen. Can anyone point out what I am doing wrong or if the FastApi Integration is broken? Ultimately, I’d like to use this with Folium, but I cannot get the basic example with a slider to work.
Thank you.
# Third Party
import uvicorn
import panel as pn
from fastapi import FastAPI
from panel.io.fastapi import add_application
pn.extension(sizing_mode="stretch_width")
app = FastAPI()
@app.get("/")
async def read_root():
return {"Hello": "World"}
@add_application("/panel", app=app, title="My Panel App")
def create_panel_app():
slider = pn.widgets.IntSlider(name="Slider", start=0, end=10, value=3)
return slider
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=8080)