problem displaying image

Hi all, I'm trying to display an image in my solara app based on a dropdown selection, but the app only displays an image icon and not the actual image, I hope you guys can help me out import solara import os import urllib.parse yearplans_path = "public/yearplans/" @solara.component def Page(): try: yearplans_directory_content = os.listdir(yearplans_path) except FileNotFoundError: yearplans_directory_content = [] select_options = [ plan.removesuffix(".png") for plan in yearplans_directory_content if plan.endswith(".png") ] selected_rider = solara.use_reactive(select_options[0] if select_options else "") with solara.Sidebar(): solara.Markdown("## Select rider") solara.Markdown("Choose the rider whose yearplan you want to inspect.") solara.Select(label="Select rider", values=select_options, value=selected_rider) with solara.Column(): solara.Markdown("### Yearplanning") if selected_rider.value: encoded_filename = urllib.parse.quote(selected_rider.value) solara.Image(f"/yearplans/{encoded_filename}.png", width = "100%")

else: solara.Markdown("No yearplans available.")
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?