Adding a local image through the showcase parameter of the ui,value_box, error.

I am trying to add an image I have saved locally (in the same file as my app.py file) to the showcase parameter in the ui.value_box().

Here is a snippet of my code:

        with ui.value_box(showcase= ui.img(src="plus.png", width = '50px')):
            "Participating States"
            @render.text
            def state_count():
                return len(pd.unique(filtered_df()["Full_State"]))

I did notice this in the terminal, but I am sure it is in the folder:
GET /plus.png HTTP/1.1" 404 Not Found

When I run it in VSCODE, I get the broken image icon.

Hi fleuryt,
to show images you shoul create a sub folder called "www" with png format. Next, when you're launching your app, write this :

www_dir = Path(__file__).parent / "www"
app = App(app_ui, server, static_assets=www_dir)

I don't know this special argument showcase, but I hope it will help !

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.