From a87423374bf653803664c43f5dfd7eedb6d14dad Mon Sep 17 00:00:00 2001 From: Laure Vancau Date: Thu, 19 Dec 2024 18:20:32 +0100 Subject: [PATCH] fix: image path in whale viewer --- src/whale_viewer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/whale_viewer.py b/src/whale_viewer.py index d5b80f0..a28a23a 100644 --- a/src/whale_viewer.py +++ b/src/whale_viewer.py @@ -2,6 +2,7 @@ from PIL import Image import pandas as pd +import os WHALE_CLASSES = [ "beluga", @@ -149,7 +150,9 @@ def display_whale(whale_classes:List[str], i:int, viewcontainer=None): viewcontainer.markdown( "### :whale: #" + str(i + 1) + ": " + format_whale_name(whale_classes[i]) ) - image = Image.open("images/references/" + df_whale_img_ref.loc[whale_classes[i], "WHALE_IMAGES"]) + current_dir = os.getcwd() + image_path = os.path.join(current_dir, "src/images/references/") + image = Image.open(image_path + df_whale_img_ref.loc[whale_classes[i], "WHALE_IMAGES"]) viewcontainer.image(image, caption=df_whale_img_ref.loc[whale_classes[i], "WHALE_REFERENCES"]) # link st.markdown(f"[{df.loc[whale_classes[i], 'WHALE_REFERENCES']}]({df.loc[whale_classes[i], 'WHALE_REFERENCES']})") \ No newline at end of file